Skip to content

Commit 37e22f0

Browse files
authored
Switch to trusted publishing (#517)
1 parent 0a8add4 commit 37e22f0

File tree

2 files changed

+45
-44
lines changed

2 files changed

+45
-44
lines changed

.github/workflows/release.yml

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,18 @@ name: Release
33
on:
44
push:
55
branches:
6-
- beta
76
- master
7+
workflow_dispatch:
88

99
jobs:
1010
release:
11+
name: Release
1112
permissions:
1213
contents: write
1314
id-token: write
1415
pull-requests: write
15-
name: Release
16+
if: github.event_name == 'push'
1617
runs-on: ubuntu-latest
17-
env:
18-
CI: true
1918
steps:
2019
- name: Check out repo
2120
uses: actions/checkout@v4
@@ -32,15 +31,56 @@ jobs:
3231
with:
3332
node-version-file: package.json
3433
cache: pnpm
34+
registry-url: https://registry.npmjs.org
3535

3636
- name: Install dependencies
3737
run: pnpm install --frozen-lockfile
3838

39+
- name: Install latest npm
40+
run: npm install -g npm@latest
41+
3942
- name: Release
4043
uses: changesets/action@v1
4144
with:
4245
publish: pnpm release
4346
version: pnpm changeset version
4447
env:
4548
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
49+
snapshot:
50+
name: Snapshot
51+
permissions:
52+
contents: write
53+
id-token: write
54+
pull-requests: write
55+
if: github.event_name == 'workflow_dispatch'
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: Check out repo
59+
uses: actions/checkout@v4
60+
with:
61+
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
62+
fetch-depth: 0
63+
token: ${{ secrets.GITHUB_TOKEN }}
64+
65+
- name: Set up pnpm
66+
uses: pnpm/action-setup@v4
67+
68+
- name: Set up Node.js
69+
uses: actions/setup-node@v4
70+
with:
71+
node-version-file: package.json
72+
cache: pnpm
73+
registry-url: https://registry.npmjs.org
74+
75+
- name: Install dependencies
76+
run: pnpm install --frozen-lockfile
77+
78+
- name: Install latest npm
79+
run: npm install -g npm@latest
80+
81+
- name: Publish to npm
82+
uses: seek-oss/changesets-snapshot@v0
83+
with:
84+
pre-publish: pnpm run build
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/snapshot.yml

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

0 commit comments

Comments
 (0)