-
-
Notifications
You must be signed in to change notification settings - Fork 54
40 lines (38 loc) · 1.14 KB
/
release.yml
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
name: Release
on:
workflow_dispatch:
inputs:
semver_type:
description: "Semver type"
required: true
type: "choice"
options:
- "patch"
- "minor"
# - "major"
default: "patch"
jobs:
main:
runs-on: ubuntu-22.04
timeout-minutes: 5
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: peaceiris/workflows/[email protected]
with:
node-version: "16"
- uses: peaceiris/workflows/[email protected]
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
run: |
CURRENT_TAG=$(git describe --tags --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}"
gh release create "${NEW_TAG}" ${{ github.event.inputs.is_draft }} --title "${RELEASE_TITLE}" --generate-notes