Skip to content

Commit 1a14a01

Browse files
committed
feat: migrate beta releases to trusted publishing
Ticket: VL-4372
1 parent a8311ce commit 1a14a01

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

.github/workflows/publish.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
permissions:
99
contents: write
10+
id-token: write
1011

1112
concurrency:
1213
group: ${{ github.workflow }}-${{ github.ref }}
@@ -20,7 +21,7 @@ jobs:
2021
runs-on: ubuntu-latest
2122

2223
steps:
23-
- uses: socketdev/action@v1
24+
- uses: socketdev/action@4337a545deecc20f19a909e52db7a2f6ba292f42 # v1
2425
with:
2526
mode: firewall-free
2627

@@ -48,16 +49,16 @@ jobs:
4849
run: |
4950
echo "preid=beta" >> $GITHUB_ENV
5051
51-
- name: Configure Git & NPM
52+
- name: Configure Git
5253
run: |
5354
git config --global user.name 'Git bot'
5455
git config --global user.email 'bot@noreply.github.com'
5556
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
5657
git checkout -b ${{ env.preid }}-$(git rev-parse --short HEAD)
57-
echo "email=${{ secrets.BETA_EMAIL }}" > .npmrc
58+
59+
- name: Configure NPM for Trusted Publishing
60+
run: |
5861
echo "@bitgo-beta:registry=https://registry.npmjs.org" >> .npmrc
59-
echo "//registry.npmjs.org/:_authToken=${{ secrets.BITGO_BETA_PUBLISH_TOKEN }}" >> .npmrc
60-
echo "//registry.npmjs.org/:always-auth=true" >> .npmrc
6162
6263
- name: Prepare Release
6364
run: |
@@ -73,6 +74,10 @@ jobs:
7374

7475
- name: Lerna Publish
7576
run: yarn lerna publish from-package --preid ${{ env.preid }} --dist-tag ${{ env.preid }} --force-publish --yes --loglevel silly
77+
env:
78+
NPM_CONFIG_PROVENANCE: true
7679

7780
- name: Verify Publish
7881
run: npx tsx ./scripts/verify-release.ts ${{ env.preid }}
82+
env:
83+
NPM_CONFIG_PROVENANCE: true

scripts/verify-release.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async function verifyPackage(dir: string, preid = 'beta'): Promise<boolean> {
2727
);
2828
const { stdout, exitCode } = await execa(
2929
'npm',
30-
['publish', '--tag', preid],
30+
['publish', '--tag', preid, '--provenance'],
3131
{ cwd },
3232
);
3333
console.log(stdout);

0 commit comments

Comments
 (0)