blob: fce9b1d32e925c6501abc4f7dccec89ae2b50996 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
name: Release
on:
workflow_dispatch:
inputs:
semver_type:
description: "Semver type"
required: true
type: "choice"
options:
- "patch"
- "minor"
# - "major"
default: "minor"
jobs:
main:
runs-on: ubuntu-20.04
timeout-minutes: 5
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: peaceiris/workflows/setup-git@v0.14.1
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
RELEASE_NOTES="./release_notes.md"
CURRENT_TAG=$(git describe --abbrev=0)
NEW_VERSION=$(npm_config_yes=true npx semver ${CURRENT_TAG} --increment ${{ github.event.inputs.semver_type }})
NEW_TAG="v${NEW_VERSION}"
RELEASE_TITLE="Release ${NEW_TAG}"
git tag -a ${NEW_TAG} -m "${RELEASE_TITLE}"
git push origin ${NEW_TAG}
echo "See [CHANGELOG](https://github.com/${GITHUB_REPOSITORY}/compare/${CURRENT_TAG}...${NEW_TAG}) for more details." > "${RELEASE_NOTES}"
gh release create "${NEW_TAG}" --title "${RELEASE_TITLE}" --notes-file "${RELEASE_NOTES}"
rm "${RELEASE_NOTES}"
|