Skip to content

Commit e4e63df

Browse files
ci: migrate to npm trusted publisher (#474)
* ci: switch to npm trusted publisher * ci: add OIDC token write permission * ci: fix permissions * fix: format * fix: update callers permissions * fix: permissions * ci: merge publish workflows to enable single trusted publisher * fix: format * ci: trigger workflow * ci: use latest publish-npm version * ci: add trusted publisher warning comment in workflow * style: update comment Co-authored-by: abbesBenayache <[email protected]> --------- Co-authored-by: abbesBenayache <[email protected]>
1 parent 8bc8c7e commit e4e63df

File tree

4 files changed

+37
-39
lines changed

4 files changed

+37
-39
lines changed

.github/workflows/npm-latest.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/npm-publish.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# ⚠️ THIS WORKFLOW IS THE TRUSTED PUBLISHER CONFIGURED ON NPMJS.COM, DO NOT RENAME OR DELETE THIS FILE ⚠️
2+
name: npm publish
3+
4+
on:
5+
# For staging releases
6+
workflow_dispatch:
7+
# For latest releases
8+
release:
9+
types: [published]
10+
11+
permissions:
12+
id-token: write # Required for OIDC
13+
packages: write
14+
contents: read
15+
16+
jobs:
17+
compute-staging-version:
18+
# Only run for manual dispatch (staging)
19+
if: github.event_name == 'workflow_dispatch'
20+
uses: ./.github/workflows/reusable-compute-staging-version.yml
21+
22+
npm-publish-staging:
23+
# Only run for manual dispatch (staging)
24+
if: github.event_name == 'workflow_dispatch'
25+
uses: ./.github/workflows/reusable-npm.yml
26+
needs: [compute-staging-version]
27+
with:
28+
version: ${{ needs.compute-staging-version.outputs.version }}
29+
tag: ${{ needs.compute-staging-version.outputs.dist-tag }}
30+
31+
npm-publish-latest:
32+
# Only run for release published (latest)
33+
if: github.event_name == 'release'
34+
uses: ./.github/workflows/reusable-npm.yml
35+
with:
36+
tag: latest

.github/workflows/npm-staging.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/reusable-npm.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,10 @@ on:
1616
description: 'npm publish tag (e.g., latest, nightly)'
1717
default: ''
1818
type: string
19-
secrets:
20-
npm-token:
21-
description: 'NPM auth token (required unless `dry-run: true`)'
22-
required: false
2319

2420
jobs:
2521
npm-publish:
26-
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/publish-npm.yml@publish-npm-v1.5.0
22+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/publish-npm.yml@publish-npm-v1.6.0
2723
with:
2824
install-command: npm ci
2925
build-command: npm run build
@@ -32,5 +28,3 @@ jobs:
3228
version: ${{ inputs.version }}
3329
environment: ${{ (inputs.dry-run && '') || inputs.tag }}
3430
provenance: ${{ !inputs.dry-run }}
35-
secrets:
36-
npm-token: ${{ secrets.npm-token }}

0 commit comments

Comments
 (0)