Skip to content

Commit 1b86bed

Browse files
authored
Merge pull request #11 from benmccann/changesets-setup
chore: copy changesets setup from CLI project
2 parents 01576fa + 1153f2e commit 1b86bed

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

.github/workflows/release.yml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,38 @@ on:
55
branches:
66
- main
77

8-
concurrency: ${{ github.workflow }}-${{ github.ref }}
9-
8+
permissions: {}
109
jobs:
1110
release:
11+
# prevents this action from running on forks
12+
if: github.repository == 'sveltejs/svelte-json-tree'
13+
permissions:
14+
contents: write # to create release (changesets/action)
15+
id-token: write # OpenID Connect token needed for provenance
16+
pull-requests: write # to create pull request (changesets/action)
1217
name: Release
1318
runs-on: ubuntu-latest
1419
steps:
1520
- name: Checkout Repo
1621
uses: actions/checkout@v4
17-
18-
- name: Setup Node.js 20
22+
with:
23+
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
24+
fetch-depth: 0
25+
- uses: pnpm/action-setup@v4.0.0
26+
- name: Setup Node.js
1927
uses: actions/setup-node@v4
2028
with:
21-
node-version: 20
29+
node-version: 22.x
30+
cache: pnpm
2231

23-
- uses: pnpm/action-setup@v4.0.0
32+
- run: pnpm install --frozen-lockfile
2433

25-
- name: Create Release Pull Request
34+
- name: Create Release Pull Request or Publish to npm
35+
id: changesets
2636
uses: changesets/action@v1
37+
with:
38+
publish: pnpm changeset:publish
2739
env:
28-
GITHUB_TOKEN: ${{ secrets.NPM_TOKEN }}
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
NPM_CONFIG_PROVENANCE: true
42+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"build": "vite build && npm run package",
2121
"build:standalone": "BUILD_MODE=standalone vite build",
2222
"build:bundled": "BUILD_MODE=bundled vite build",
23+
"changeset:publish": "changeset publish",
2324
"preview": "vite preview",
2425
"package": "svelte-kit sync && svelte-package -i src/lib/svelte-json-tree -o dist/lib && pnpm build:standalone && pnpm build:bundled && publint",
2526
"prepublishOnly": "npm run package",

0 commit comments

Comments
 (0)