Skip to content

Commit 23401db

Browse files
committed
CI: also publish stable versions with the latest tag
1 parent adff620 commit 23401db

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

.github/workflows/publish.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
tags:
66
- 'v0.[0-9]+.[0-9]+-SNAPSHOT.[0-9]+'
7+
- 'v0.[0-9]+.[0-9]+'
78

89
permissions: {}
910

@@ -24,8 +25,20 @@ jobs:
2425
- name: Update npm
2526
run: npm install -g npm@latest
2627
- run: npm ci
28+
- name: Select dist-tag
29+
run: |
30+
GIT_TAG=${GITHUB_REF#refs/tags/*}
31+
if [[ "$GIT_TAG" == v0.+([0-9]).+([0-9])-SNAPSHOT.+([0-9]) ]]; then
32+
DIST_TAG=next
33+
elif [[ "$GIT_TAG" == v0.+([0-9]).+([0-9]) ]]; then
34+
DIST_TAG=latest
35+
else
36+
echo "Error: the tag name '$GIT_TAG' does not match any of the patterns"
37+
exit 1
38+
fi
39+
echo "DIST_TAG=$DIST_TAG" >> "$GITHUB_ENV"
2740
- name: Check that KaitaiStream.js will be included
2841
run: |
29-
npm publish --tag next --dry-run --json | jq --exit-status '.files | map(.path) | any(. == "KaitaiStream.js")'
42+
npm publish --tag "$DIST_TAG" --dry-run --json | jq --exit-status '.files | map(.path) | any(. == "KaitaiStream.js")'
3043
- name: Publish to npm
31-
run: npm publish --tag next
44+
run: npm publish --tag "$DIST_TAG"

0 commit comments

Comments
 (0)