Skip to content

Commit c767e1c

Browse files
ci: fix and factor npm publication workflow (#50)
1 parent 9895a48 commit c767e1c

File tree

4 files changed

+41
-10
lines changed

4 files changed

+41
-10
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: npm publish SDK
2+
description: reusable npm workflow for this project
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
dry-run:
8+
description: 'Run in dry-run mode (the package will not be published)'
9+
default: false
10+
type: boolean
11+
version:
12+
description: 'Version to publish (leave empty to use package.json version)'
13+
default: ''
14+
type: string
15+
tag:
16+
description: 'npm publish tag (e.g., latest, nightly)'
17+
default: ''
18+
type: string
19+
secrets:
20+
npm-token:
21+
description: 'NPM auth token (required unless `dry-run: true`)'
22+
required: false
23+
24+
jobs:
25+
publish-npm:
26+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
27+
with:
28+
scope: '@iexec/web3telegram'
29+
tag: ${{ inputs.tag }}
30+
version: ${{ inputs.version }}
31+
environment: ${{ (inputs.dry-run && '') || inputs.tag }}
32+
provenance: ${{ !inputs.dry-run }}
33+
dry-run: ${{ inputs.dry-run }}
34+
secrets:
35+
npm-token: ${{ secrets.npm-token }}

.github/workflows/sdk-ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,7 @@ jobs:
8282
- name: Build
8383
run: npm run build
8484

85-
- name: publish dry-run
86-
run: npm publish --dry-run
85+
npm-publish-dry-run:
86+
uses: ./.github/workflows/reusable-sdk-npm.yml
87+
with:
88+
dry-run: true
Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,10 @@ jobs:
3939
publish-npm:
4040
# Run only on main branch
4141
if: github.ref == 'refs/heads/main'
42-
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/publish-npm.yml@publish-npm-v1.5.0
42+
uses: ./.github/workflows/reusable-sdk-npm.yml
4343
needs: set-publish-version
4444
with:
45-
scope: '@iexec/web3telegram'
46-
registry: 'https://registry.npmjs.org'
47-
node-version: '18'
48-
environment: ${{ github.event.inputs.target }}
4945
tag: ${{ github.event.inputs.tag }}
5046
version: ${{ needs.set-publish-version.outputs.VERSION }}
51-
install-command: |
52-
npm ci
5347
secrets:
5448
npm-token: ${{ secrets.NPM_TOKEN }}

.github/workflows/sdk-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
publish-npm:
10-
uses: ./.github/workflows/publish-npm-sdk.yml
10+
uses: ./.github/workflows/reusable-sdk-npm.yml
1111
with:
1212
tag: 'latest'
1313
secrets:

0 commit comments

Comments
 (0)