Skip to content

Commit c0f48ff

Browse files
committed
Try to fix prerelease logic
1 parent 1d6bdd8 commit c0f48ff

File tree

1 file changed

+29
-20
lines changed

1 file changed

+29
-20
lines changed

.github/workflows/create-release.yml

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,34 @@ name: Create Release
33
on:
44
workflow_dispatch:
55
inputs:
6-
versioning_phase:
6+
release_type:
77
type: choice
8-
description: Versioning Phase
8+
description: "Type of release to create"
99
default: stable
1010
options:
11+
- stable
1112
- alpha
1213
- beta
1314
- rc
14-
- stable
1515

16-
bump_version_number:
16+
version_bump:
1717
type: choice
18-
description: Bump Version Number
19-
default: consecutive
18+
description: "Which part of the version to increment"
19+
default: patch
2020
options:
21-
- consecutive
2221
- patch
2322
- minor
2423
- major
25-
24+
25+
continue_prerelease:
26+
type: boolean
27+
description: "Continue an existing alpha/beta/rc series instead of starting a new one"
28+
default: false
29+
2630
is_dry_run:
2731
type: boolean
28-
description: Dry Run
32+
description: "Simulate the release without making any changes"
33+
default: false
2934

3035
jobs:
3136
release-it:
@@ -41,7 +46,6 @@ jobs:
4146
uses: actions/checkout@v4
4247
with:
4348
token: ${{ steps.generate-token.outputs.token }}
44-
# we need everything so release-it can compare the current version with the latest tag
4549
fetch-depth: 0
4650

4751
- name: initialize mandatory git config
@@ -56,18 +60,23 @@ jobs:
5660
run: |
5761
params=()
5862
59-
if [[ ${{ github.event.inputs.bump_version_number }} != "consecutive" ]]; then
60-
params+=(${{ github.event.inputs.bump_version_number }})
61-
fi
62-
63-
if [[ ${{ github.event.inputs.versioning_phase }} != "stable" ]]; then
64-
params+=(--preRelease=${{ github.event.inputs.versioning_phase }})
65-
params+=(--plugins.@release-it/keep-a-changelog.keepUnreleased)
66-
params+=(--no-plugins.@release-it/keep-a-changelog.strictLatest)
63+
# Determine prerelease logic
64+
if [[ "${{ github.event.inputs.release_type }}" == "stable" ]]; then
65+
params+=(--${{ github.event.inputs.version_bump }})
66+
elif [[ "${{ github.event.inputs.continue_prerelease }}" == "true" ]]; then
67+
params+=(--increment=prerelease)
68+
params+=(--preRelease=${{ github.event.inputs.release_type }})
69+
params+=(--plugins.@release-it/keep-a-changelog.keepUnreleased)
70+
params+=(--no-plugins.@release-it/keep-a-changelog.strictLatest)
71+
else
72+
params+=(--${{ github.event.inputs.version_bump }})
73+
params+=(--preRelease=${{ github.event.inputs.release_type }})
74+
params+=(--plugins.@release-it/keep-a-changelog.keepUnreleased)
75+
params+=(--no-plugins.@release-it/keep-a-changelog.strictLatest)
6776
fi
6877
69-
if [[ ${{ github.event.inputs.is_dry_run }} == "true" ]]; then
70-
params+=(--dry-run)
78+
if [[ "${{ github.event.inputs.is_dry_run }}" == "true" ]]; then
79+
params+=(--dry-run)
7180
fi
7281
7382
params+=(--ci)

0 commit comments

Comments
 (0)