Skip to content

Commit 2ba333d

Browse files
authored
Update Changesets (#129)
* Update Changesets publishing workflow * Clarify checkout fetch depth input * Remove obsolete publish script
1 parent 6ff30f9 commit 2ba333d

7 files changed

Lines changed: 299 additions & 591 deletions

File tree

.changeset/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
2+
"$schema": "https://unpkg.com/@changesets/config@4.0.0/schema.json",
33
"changelog": [
44
"@changesets/changelog-github",
55
{ "repo": "changesets/ghcommit" }

.github/actions/ci-setup/action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,20 @@ inputs:
1010
description: "Whether to skip the cache"
1111
required: false
1212
default: "false"
13+
checkout-fetch-depth:
14+
description: "Number of commits to fetch"
15+
required: false
16+
default: "1"
1317

1418
runs:
1519
using: composite
1620
steps:
21+
- name: Check out repo
22+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
23+
with:
24+
fetch-depth: ${{ inputs.checkout-fetch-depth }}
25+
persist-credentials: false
26+
1727
- name: Set up pnpm
1828
uses: pnpm/action-setup@91ab88e2619ed1f46221f0ba42d1492c02baf788 # v6.0.6
1929

.github/workflows/ci.yml

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ jobs:
3232
persist-credentials: false
3333

3434
- name: Run zizmor
35-
uses: zizmorcore/zizmor-action@6599ee8b7a49aef6a770f63d261d214911a7ce02 # v0.6.0
35+
uses: zizmorcore/zizmor-action@3dc1ecc9bcb9e94e9b2c709687979e1298497054 # v0.6.2
3636
with:
37+
version: "1.29.0"
3738
persona: pedantic
3839
annotations: true
3940
advanced-security: false
@@ -43,12 +44,7 @@ jobs:
4344
runs-on: ubuntu-latest
4445
timeout-minutes: 10
4546
steps:
46-
- name: Check out repo
47-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
48-
with:
49-
persist-credentials: false
50-
51-
- uses: ./.github/actions/ci-setup
47+
- uses: $/.github/actions/ci-setup
5248

5349
- name: Build
5450
run: pnpm build
@@ -69,14 +65,9 @@ jobs:
6965
permissions:
7066
contents: write # integration tests create and push temporary branches
7167
steps:
72-
- name: Check out repo
73-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
74-
with:
75-
fetch-depth: 2 # integration tests read the two most recent local commits
76-
persist-credentials: false
77-
78-
- uses: ./.github/actions/ci-setup
68+
- uses: $/.github/actions/ci-setup
7969
with:
70+
checkout-fetch-depth: 2 # integration tests read the two most recent local commits
8071
skip-cache: true # avoid cache poisoning from this only job with write access, just in case
8172

8273
- name: Build
@@ -92,11 +83,7 @@ jobs:
9283
runs-on: ubuntu-latest
9384
timeout-minutes: 10
9485
steps:
95-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
96-
with:
97-
persist-credentials: false
98-
99-
- uses: ./.github/actions/ci-setup
86+
- uses: $/.github/actions/ci-setup
10087

10188
- name: Codegen
10289
run: pnpm codegen:github
@@ -109,11 +96,7 @@ jobs:
10996
runs-on: ubuntu-latest
11097
timeout-minutes: 10
11198
steps:
112-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
113-
with:
114-
persist-credentials: false
115-
116-
- uses: ./.github/actions/ci-setup
99+
- uses: $/.github/actions/ci-setup
117100

118101
- name: Codegen
119102
run: pnpm codegen:github

.github/workflows/publish.yml

Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,36 @@ concurrency:
1515
permissions: {} # each job should define its own permission explicitly
1616

1717
jobs:
18-
version:
19-
name: Version
18+
select-mode:
19+
name: Select Mode
2020
runs-on: ubuntu-latest
2121
environment: version
2222
timeout-minutes: 10
2323
outputs:
24-
hasChangesets: ${{ steps.changesets.outputs.hasChangesets }}
24+
mode: ${{ steps.select-mode.outputs.mode }}
25+
publish-plan-artifact-id: ${{ steps.select-mode.outputs.publish-plan-artifact-id }}
2526
permissions:
2627
contents: read # to check out repo (actions/checkout)
2728
steps:
28-
- name: Check out repo
29-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
29+
- uses: $/.github/actions/ci-setup
3030
with:
31-
persist-credentials: false
31+
skip-cache: true # avoid cache poisoning attacks
32+
33+
- name: Select mode
34+
id: select-mode
35+
uses: changesets/action/select-mode@22ccf9aa43179fe9e27dc62e575971d28cce197c # v2.0.0
3236

33-
- uses: ./.github/actions/ci-setup
37+
version:
38+
name: Version
39+
needs: select-mode
40+
if: needs.select-mode.outputs.mode == 'version'
41+
runs-on: ubuntu-latest
42+
environment: version
43+
timeout-minutes: 10
44+
permissions:
45+
contents: read # to check out repo (actions/checkout)
46+
steps:
47+
- uses: $/.github/actions/ci-setup
3448
with:
3549
skip-cache: true # avoid cache poisoning attacks
3650

@@ -44,33 +58,50 @@ jobs:
4458

4559
- name: Create or update release pull request
4660
id: changesets
47-
uses: changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d # v1.9.0
61+
uses: changesets/action/version@22ccf9aa43179fe9e27dc62e575971d28cce197c # v2.0.0
4862
with:
4963
github-token: ${{ steps.app-token.outputs.token }}
50-
version: pnpm version-packages
64+
script: pnpm version-packages
65+
66+
pack:
67+
name: Pack
68+
needs: select-mode
69+
if: needs.select-mode.outputs.mode == 'publish'
70+
runs-on: ubuntu-latest
71+
timeout-minutes: 10
72+
outputs:
73+
pack-dir-artifact-id: ${{ steps.pack.outputs.pack-dir-artifact-id }}
74+
permissions:
75+
contents: read # to check out repo (actions/checkout)
76+
steps:
77+
- uses: $/.github/actions/ci-setup
78+
with:
79+
skip-cache: true # avoid cache poisoning attacks
80+
81+
- name: Build
82+
run: pnpm build
83+
84+
- name: Pack
85+
id: pack
86+
uses: changesets/action/pack@22ccf9aa43179fe9e27dc62e575971d28cce197c # v2.0.0
87+
with:
88+
publish-plan-artifact-id: ${{ needs.select-mode.outputs.publish-plan-artifact-id }}
5189

5290
publish:
5391
name: Publish
54-
if: needs.version.outputs.hasChangesets == 'false'
55-
needs: version
92+
needs: pack
5693
runs-on: ubuntu-latest
5794
environment: npm
5895
timeout-minutes: 10
5996
permissions:
6097
contents: write # to create release (changesets/action)
6198
id-token: write # to use OpenID Connect token for trusted publishing (changesets/action)
6299
steps:
63-
- name: Check out repo
64-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
65-
with:
66-
persist-credentials: false
67-
68-
- uses: ./.github/actions/ci-setup
100+
- uses: $/.github/actions/ci-setup
69101
with:
70102
skip-cache: true # avoid cache poisoning attacks
71103

72104
- name: Publish to npm
73-
uses: changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d # v1.9.0
105+
uses: changesets/action/publish@22ccf9aa43179fe9e27dc62e575971d28cce197c # v2.0.0
74106
with:
75-
publish: pnpm release
76-
commitMode: github-api
107+
pack-dir-artifact-id: ${{ needs.pack.outputs.pack-dir-artifact-id }}

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,15 @@
4242
"lint": "oxlint",
4343
"test:unit": "vitest",
4444
"test:integration": "vitest -c vitest.integration.config.ts",
45-
"version-packages": "changeset version && pnpm format:fix",
46-
"release": "pnpm build && changeset publish"
45+
"version-packages": "changeset version && pnpm format:fix"
4746
},
4847
"dependencies": {
4948
"tinyexec": "^1.2.4"
5049
},
5150
"devDependencies": {
5251
"@actions/github": "^9.1.1",
53-
"@changesets/changelog-github": "^0.7.0",
54-
"@changesets/cli": "^2.31.1",
52+
"@changesets/changelog-github": "^1.0.0",
53+
"@changesets/cli": "^3.0.0",
5554
"@graphql-codegen/cli": "^7.2.0",
5655
"@tsconfig/node22": "^22.0.5",
5756
"@types/node": "^26.1.1",

0 commit comments

Comments
 (0)