Skip to content

Commit 3f69bcd

Browse files
ci(sdk): fix npm (#452)
1 parent 175231a commit 3f69bcd

File tree

1 file changed

+36
-7
lines changed

1 file changed

+36
-7
lines changed

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

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,52 @@ name: Publish Package NPM
33
on:
44
workflow_dispatch:
55
inputs:
6-
target:
7-
description: 'Select deployment target'
6+
tag:
7+
description: 'NPM tag to publish (latest or nightly)'
88
required: true
9-
default: staging
109
type: choice
1110
options:
12-
- staging
13-
- prod
11+
- latest
12+
- nightly
13+
- beta
14+
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:
17-
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
40+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
41+
needs: set-publish-version
1842
with:
1943
scope: '@iexec/dataprotector-sdk'
2044
registry: 'https://registry.npmjs.org'
2145
node-version: '18'
2246
environment: ${{ github.event.inputs.target }}
23-
working-directory: packages/sdk
47+
working-directory: packages/sdk
48+
tag: ${{ github.event.inputs.tag }}
49+
version: ${{ needs.set-publish-version.outputs.VERSION }}
50+
install-command: |
51+
npm ci
52+
npm run codegen
2453
secrets:
2554
npm-token: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)