Skip to content

Commit 5d1f0e2

Browse files
author
Tanjeem Hossain
authored
Merge pull request #12 from BitGo/DX-2083-trusted-publishing
ci: migrate to OIDC trusted publishing
2 parents 7853a2f + d67e76e commit 5d1f0e2

5 files changed

Lines changed: 1121 additions & 573 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
version: [18.x,20.x]
14+
version: [22.x]
1515
name: Lint, build and test
1616
runs-on: ubuntu-latest
1717
steps:

.github/workflows/prerelease.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
name: Prerelease
2+
permissions:
3+
# Needed for npm Trusted Publishing
4+
id-token: write
5+
# Needed for semantic-release
6+
contents: write
7+
pull-requests: write
8+
issues: write
29
on:
310
push:
411
branches:
@@ -7,6 +14,7 @@ jobs:
714
release:
815
name: Prerelease
916
runs-on: ubuntu-latest
17+
environment: publish
1018
steps:
1119
- name: Checkout
1220
uses: actions/checkout@v4
@@ -15,14 +23,16 @@ jobs:
1523
- name: Setup Node.js
1624
uses: actions/setup-node@v4
1725
with:
18-
node-version: 20.x
26+
node-version: 22.x
27+
- name: Ensure npm 11.5.1 or later for trusted publishing
28+
run: |
29+
npm install -g npm@11.5.1
1930
- name: Install dependencies
2031
run: yarn
2132
- name: Build library
2233
run: yarn build:prod
2334
- name: Release
2435
env:
2536
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2737
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
2838
run: yarn run semantic-release

.github/workflows/release.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
name: Release
2+
permissions:
3+
# Needed for npm Trusted Publishing
4+
id-token: write
5+
# Needed for semantic-release
6+
contents: write
7+
pull-requests: write
8+
issues: write
29
on:
310
push:
411
branches:
@@ -7,6 +14,7 @@ jobs:
714
release:
815
name: Release
916
runs-on: ubuntu-latest
17+
environment: publish
1018
steps:
1119
- name: Checkout
1220
uses: actions/checkout@v4
@@ -15,15 +23,17 @@ jobs:
1523
- name: Setup Node.js
1624
uses: actions/setup-node@v4
1725
with:
18-
node-version: 20.x
26+
node-version: 22.x
27+
- name: Ensure npm 11.5.1 or later for trusted publishing
28+
run: |
29+
npm install -g npm@11.5.1
1930
- name: Install dependencies
2031
run: yarn
2132
- name: Build library
2233
run: yarn build:prod
2334
- name: Release
2435
env:
2536
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2737
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
2838
run: yarn run semantic-release
2939
- name: Rebase master

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"@semantic-release/commit-analyzer": "11.1.0",
5050
"@semantic-release/git": "10.0.1",
5151
"@semantic-release/github": "9.2.6",
52-
"@semantic-release/npm": "11.0.2",
52+
"@semantic-release/npm": "13.1.1",
5353
"@types/jest": "29.5.11",
5454
"@types/node": "18.18.7",
5555
"@typescript-eslint/eslint-plugin": "6.18.1",

0 commit comments

Comments
 (0)