Skip to content

Commit ebdb382

Browse files
ci(deserializer): fix npm (#451)
1 parent 3f69bcd commit ebdb382

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed
Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish Package NPM
1+
name: Publish Package NPM - Deserializer
22

33
on:
44
workflow_dispatch:
@@ -10,30 +10,50 @@ on:
1010
options:
1111
- latest
1212
- nightly
13+
- beta
1314
default: nightly
1415

1516
jobs:
16-
set-env:
17+
set-publish-version:
1718
runs-on: ubuntu-latest
18-
outputs:
19-
resolved-environment: ${{ steps.setenv.outputs.env }}
2019
steps:
21-
- id: setenv
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
2228
run: |
23-
if [ "${{ github.event.inputs.tag }}" = "latest" ]; then
24-
echo "env=production" >> $GITHUB_OUTPUT
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
2533
else
26-
echo "env=staging" >> $GITHUB_OUTPUT
34+
echo "VERSION=$(npm pkg get version | tr -d '"')" >> $GITHUB_OUTPUT
2735
fi
36+
outputs:
37+
VERSION: ${{ steps.set-publish-version.outputs.VERSION }}
2838

2939
publish-npm:
30-
needs: set-env
31-
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/publish-[email protected]
40+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
41+
needs: set-publish-version
3242
with:
3343
scope: '@iexec/deserializer'
3444
registry: 'https://registry.npmjs.org'
3545
node-version: '18'
36-
environment: ${{ needs.set-env.outputs.resolved-environment }}
46+
tag: ${{ github.event.inputs.tag }}
47+
environment: production
3748
working-directory: "packages/dataprotector-deserializer"
49+
version: ${{ needs.set-publish-version.outputs.VERSION }}
50+
install-command: |
51+
npm ci
52+
cd ../sdk
53+
npm ci
54+
npm run codegen
55+
npm run build
56+
cd ../dataprotector-deserializer
57+
npm run test:prepare
3858
secrets:
3959
npm-token: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)