Skip to content

Commit 12945b7

Browse files
authored
chore: enable proper prereleases (#181)
Signed-off-by: Jan Kowalleck <[email protected]> Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 278851c commit 12945b7

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

.github/workflows/release.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ on:
1313
description: 'Release/commit message (%s will be replaced with the resulting version number)'
1414
default: '%s'
1515
required: true
16+
preid:
17+
description: 'The "prerelease identifier" to use as a prefix for the "prerelease" part of a semver. Like the rc in `1.2.0-rc.8`.'
18+
type: choice
19+
options:
20+
- rc
21+
- beta
22+
- alpha
23+
default: rc
24+
required: false
1625

1726
env:
1827
REPORTS_DIR: CI_reports
@@ -23,7 +32,7 @@ jobs:
2332
name: bump and tag release
2433
concurrency: release-bump
2534
outputs:
26-
version: ${{ steps.bump.outputs.version }}
35+
version: ${{ steps.bump.outputs.version }}
2736
version_plain: ${{ steps.bump.outputs.version_plain }}
2837
runs-on: ubuntu-latest
2938
timeout-minutes: 30
@@ -47,7 +56,7 @@ jobs:
4756
id: bump
4857
run: |
4958
set -ex
50-
VERSION="$(npm version "$NPMV_NEWVERSION" --message "$NPMV_MESSAGE")"
59+
VERSION="$(npm version "$NPMV_NEWVERSION" --message "$NPMV_MESSAGE" --preid "$NPMV_PREID")"
5160
echo "::debug::new version = $VERSION"
5261
VERSION_PLAIN="${VERSION:1}" # remove 'v' prefix
5362
echo "::debug::plain version = $VERSION_PLAIN"
@@ -56,8 +65,10 @@ jobs:
5665
env:
5766
NPMV_NEWVERSION: ${{ github.event.inputs.newversion }}
5867
NPMV_MESSAGE: ${{ github.event.inputs.commitMessage }}
68+
NPMV_PREID: ${{ github.event.inputs.preid }}
5969
- name: git push back
6070
run: git push --follow-tags
71+
6172
publish-NPMJS:
6273
needs:
6374
- "bump"
@@ -84,6 +95,7 @@ jobs:
8495
npm publish --access public
8596
env:
8697
NPMJS_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
98+
8799
release-GH:
88100
needs:
89101
- "bump"
@@ -102,5 +114,5 @@ jobs:
102114
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103115
with:
104116
tag_name: ${{ needs.bump.outputs.version }}
105-
name: ${{ needs.bump.outputs.version_plain }}
106-
prerelease: ${{ startsWith(github.event.inputs.newversion, 'pre') }}
117+
name: ${{ needs.bump.outputs.version_plain }}
118+
prerelease: ${{ startsWith(github.event.inputs.newversion, 'pre') || contains(github.event.inputs.newversion, 'rc') || contains(github.event.inputs.newversion, 'beta') || contains(github.event.inputs.newversion, 'alpha')}}

0 commit comments

Comments
 (0)