Skip to content

Commit 69bf4d8

Browse files
committed
ci: Determine NPM package dist tag from git tag
1 parent 62ad233 commit 69bf4d8

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

.github/workflows/publish.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# ⚠️ THIS WORKFLOW IS THE TRUSTED PUBLISHER CONFIGURED ON NPMJS.COM, DO NOT RENAME OR DELETE THIS FILE ⚠️
2+
23
name: Publish NPM Package
34

45
on:
@@ -10,10 +11,27 @@ jobs:
1011
build-and-test:
1112
uses: ./.github/workflows/main.yml
1213

13-
publish:
14+
determine-dist-tag:
1415
needs: build-and-test
16+
runs-on: ubuntu-latest
17+
outputs:
18+
TAG: ${{ steps.set-dist-tag.outputs.TAG }}
19+
steps:
20+
- name: Determine package dist tag
21+
id: set-dist-tag
22+
run: |
23+
if [[ "${GITHUB_REF#refs/tags/}" == *"-rc"* ]]; then
24+
echo "TAG=rc" >> $GITHUB_OUTPUT
25+
else
26+
echo "TAG=latest" >> $GITHUB_OUTPUT
27+
fi
28+
29+
publish:
30+
needs: determine-dist-tag
1531
permissions:
1632
id-token: write # Required for OIDC
1733
packages: write
1834
contents: read
1935
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
36+
with:
37+
tag: ${{ needs.determine-dist-tag.outputs.TAG }}

0 commit comments

Comments
 (0)