Skip to content

Commit 7b8168d

Browse files
authored
Set prerelease version
1 parent 989d8ea commit 7b8168d

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

.github/actions/local-build/action.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,25 @@ runs:
2222
- run: npm clean-install
2323
shell: bash
2424

25-
- name: npm version ${{ needs.prepare.outputs.version }}
25+
- id: get-version-type
2626
run: |
27-
npm version ${{ needs.prepare.outputs.version }} \
27+
VERSION=$(cat package.json | jq -r '.version')
28+
29+
if [[ "$VERSION" == *-* ]]; then echo version-type=prerelease | tee --append $GITHUB_OUTPUT; else echo version-type=production | tee --append $GITHUB_OUTPUT; fi
30+
shell: bash
31+
32+
- if: steps.get-version-type.outputs.version-type != 'production'
33+
name: npm version
34+
run: |
35+
BRANCH_NAME=${{ github.ref_name }}
36+
COMMITISH=${{ github.sha }}
37+
NOW=$(date +%Y%m%d%H%M)
38+
39+
SHORT_COMMITISH=${COMMITISH:0:7}
40+
41+
VERSION=$(echo $(cat ./package.json | jq -r '.version') | cut -d- -f1)-$BRANCH_NAME.$NOW.$SHORT_COMMITISH
42+
43+
npm version $VERSION \
2844
--include-workspace-root \
2945
--no-git-tag-version \
3046
--no-workspaces-update \

0 commit comments

Comments
 (0)