Skip to content

Commit 12c0ca4

Browse files
ci: migrate to npm trusted publisher (#232)
ci: switch to npm trusted publisher
1 parent b7c073a commit 12c0ca4

File tree

4 files changed

+50
-72
lines changed

4 files changed

+50
-72
lines changed

.github/workflows/reusable-npm.yml

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

2319
jobs:
2420
npm-publish:
25-
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/publish-npm.yml@publish-npm-v1.5.0
21+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/publish-npm.yml@publish-npm-v1.6.0
2622
with:
2723
install-command: npm ci
2824
build-command: npm run build
@@ -31,5 +27,3 @@ jobs:
3127
version: ${{ inputs.version }}
3228
environment: ${{ (inputs.dry-run && '') || inputs.tag }}
3329
provenance: ${{ !inputs.dry-run }}
34-
secrets:
35-
npm-token: ${{ secrets.npm-token }}

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

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# ⚠️ THIS WORKFLOW IS THE TRUSTED PUBLISHER CONFIGURED ON NPMJS.COM, DO NOT RENAME OR DELETE THIS FILE ⚠️
2+
name: Publish NPM Package
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+
set-staging-version:
18+
# Only run for manual dispatch on main branch
19+
if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
- name: Set up Node.js
25+
uses: actions/setup-node@v4
26+
- name: Set publish version
27+
id: set-staging-version
28+
run: |
29+
CURRENT_VERSION=$(npm pkg get version | tr -d '"')
30+
NIGHTLY_VERSION="${CURRENT_VERSION}-nightly-${GITHUB_SHA::7}"
31+
echo "VERSION=${NIGHTLY_VERSION}" >> $GITHUB_OUTPUT
32+
outputs:
33+
VERSION: ${{ steps.set-staging-version.outputs.VERSION }}
34+
35+
publish-npm-staging:
36+
# Only run for manual dispatch on main branch
37+
if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
38+
uses: ./.github/workflows/reusable-npm.yml
39+
needs: set-staging-version
40+
with:
41+
tag: ${{ github.event.inputs.tag }}
42+
version: ${{ needs.set-staging-version.outputs.VERSION }}
43+
44+
publish-npm-latest:
45+
# # Only run for release published with tag "web3mail-v*"
46+
if: ${{ github.event_name == 'release' && startsWith(github.ref_name,'web3mail-v') }}
47+
uses: ./.github/workflows/reusable-npm.yml
48+
with:
49+
tag: 'latest'

.github/workflows/sdk-release.yml

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

0 commit comments

Comments
 (0)