Skip to content

Commit a98396a

Browse files
committed
fix: add set-publish-version job to manage versioning for nightly and default tags
1 parent 56dfc22 commit a98396a

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

.github/workflows/publish-npm-deserializer.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,43 @@ on:
1010
options:
1111
- latest
1212
- nightly
13+
- beta
1314
default: nightly
1415

1516
jobs:
17+
set-publish-version:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
- name: Set up Node.js
23+
uses: actions/setup-node@v4
24+
- name: Set publish version
25+
id: set-publish-version
26+
if: github.event.inputs.tag == 'nightly'
27+
working-directory: packages/sdk
28+
run: |
29+
if [ "${{ github.event.inputs.tag }}" == "nightly" ]; then
30+
CURRENT_VERSION=$(npm pkg get version | tr -d '"')
31+
NIGHTLY_VERSION="${CURRENT_VERSION}-nightly-${GITHUB_SHA::7}"
32+
echo "VERSION=${NIGHTLY_VERSION}" >> $GITHUB_OUTPUT
33+
else
34+
echo "VERSION=$(npm pkg get version | tr -d '"')" >> $GITHUB_OUTPUT
35+
fi
36+
outputs:
37+
VERSION: ${{ steps.set-publish-version.outputs.VERSION }}
38+
1639
publish-npm:
1740
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/publish-npm.yml@feat/publish-npm
41+
needs: set-publish-version
1842
with:
1943
scope: '@iexec/deserializer'
2044
registry: 'https://registry.npmjs.org'
2145
node-version: '18'
2246
tag: ${{ github.event.inputs.tag }}
2347
environment: production
2448
working-directory: "packages/dataprotector-deserializer"
49+
version: ${{ needs.set-publish-version.outputs.VERSION }}
2550
install-command: |
2651
npm ci
2752
cd ../sdk
@@ -31,4 +56,4 @@ jobs:
3156
cd ../dataprotector-deserializer
3257
npm run test:prepare
3358
secrets:
34-
npm-token: ${{ secrets.NPM_TOKEN }}
59+
npm-token: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)