Skip to content

Commit 67aabb5

Browse files
ci: migrate @iexec/dataprotector to trusted publisher
1 parent 46e3c45 commit 67aabb5

File tree

3 files changed

+65
-67
lines changed

3 files changed

+65
-67
lines changed

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

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

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

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# ⚠️ THIS WORKFLOW IS THE TRUSTED PUBLISHER CONFIGURED ON NPMJS.COM, DO NOT RENAME OR DELETE IT ⚠️
2+
name: SDK - Publish NPM
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+
working-directory: packages/sdk
29+
run: |
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+
outputs:
34+
VERSION: ${{ steps.set-staging-version.outputs.VERSION }}
35+
36+
publish-npm-staging:
37+
# Only run for manual dispatch on main branch
38+
if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
39+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
40+
needs: set-staging-version
41+
with:
42+
scope: '@iexec/dataprotector'
43+
registry: 'https://registry.npmjs.org'
44+
node-version: '18'
45+
environment: 'staging'
46+
working-directory: packages/sdk
47+
tag: 'nightly'
48+
version: ${{ needs.set-staging-version.outputs.VERSION }}
49+
install-command: |
50+
npm ci
51+
npm run codegen
52+
53+
publish-npm-latest:
54+
# # Only run for release published with tag "dataprotector-v*"
55+
if: ${{ github.event_name == 'release' && startsWith(github.ref_name,'dataprotector-v') }}
56+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
57+
with:
58+
scope: '@iexec/dataprotector'
59+
registry: 'https://registry.npmjs.org'
60+
node-version: '18'
61+
working-directory: packages/sdk
62+
tag: 'latest'
63+
install-command: |
64+
npm ci
65+
npm run codegen

0 commit comments

Comments
 (0)