Skip to content

Commit 513440f

Browse files
committed
Switch version.yml to hardcoded preid 'beta'
After discussion in the PR, I've decided it is actually better to reduce the complexity and hardcode the preId when making pre* level versions. Leaving my comment blocks in this commit for posterity, but I'll delete them in the next because I don't think it needs to exist in master.
1 parent 03cec9d commit 513440f

File tree

1 file changed

+37
-22
lines changed

1 file changed

+37
-22
lines changed

.github/workflows/version.yml

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,47 @@ on:
99
default: 'patch'
1010
type: choice
1111
options:
12-
- patch
13-
- minor
14-
- major
15-
- prerelease
16-
- prepatch
17-
- preminor
18-
- premajor
19-
preId:
20-
description: 'Prerelease identifier (required with pre*)'
21-
required: false
22-
type: string
12+
- patch
13+
- minor
14+
- major
15+
- prerelease
16+
- prepatch
17+
- preminor
18+
- premajor
19+
# Uncomment the following for text input preId
20+
# preId:
21+
# description: 'Prerelease identifier (required with pre*)'
22+
# required: false
23+
# type: string
24+
# Uncomment the following for selection preId
25+
# preId:
26+
# description: 'Prerelease identifier (used with pre*)'
27+
# required: true
28+
# default: 'beta'
29+
# type: choice
30+
# options:
31+
# - alpha
32+
# - beta
2333

2434
jobs:
25-
validate:
26-
name: Validate workflow inputs
27-
runs-on: ubuntu-latest
35+
# Uncomment the following step if using text input preId
36+
# validate:
37+
# name: Validate workflow inputs
38+
# runs-on: ubuntu-latest
2839

29-
steps:
30-
- name: Invalid prerelease identifier
31-
if: ${{ startsWith(github.event.inputs.version, 'pre') && !github.event.inputs.preId }}
32-
run: |
33-
echo "Error: 'preId' input is required with 'pre-*' version."
34-
exit 1
40+
# steps:
41+
# - name: Invalid prerelease identifier
42+
# if: ${{ startsWith(github.event.inputs.version, 'pre') && !github.event.inputs.preId }}
43+
# run: |
44+
# echo "Error: 'preId' input is required with 'pre-*' version."
45+
# exit 1
3546

3647
version:
3748
name: Push ${{ inputs.version }} tag
3849
runs-on: ubuntu-latest
3950

40-
needs: [validate]
51+
# Uncomment the following line if using the validate step above
52+
# needs: [validate]
4153

4254
steps:
4355
- name: Checkout branch
@@ -56,6 +68,9 @@ jobs:
5668
git config --global user.name "${{ github.actor }}"
5769
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
5870
- name: NPM version
59-
run: echo "version=$(npm version ${{ inputs.version }}${{ inputs.preId && format(' --preid {0}', inputs.preId) || '' }})" >> $GITHUB_ENV
71+
# Uncomment the following line if using preId input
72+
# run: echo "version=$(npm version ${{ inputs.version }}${{ startsWith(inputs.version, 'pre') && format(' --preid {0}', inputs.preId) || '' }})" >> "$GITHUB_ENV"
73+
# Uncomment the following line for hardcoded 'beta' preId
74+
run: echo "version=$(npm version ${{ inputs.version }})${{ startsWith(inputs.version, 'pre') && '--preid beta' || ''}}" >> "$GITHUB_ENV"
6075
- name: Git push
6176
run: git push && git push origin ${{ env.version }}

0 commit comments

Comments
 (0)