Skip to content

Commit 502a039

Browse files
committed
chore: add changesets release workflows
Two workflows: - changesets-pr.yml: creates/updates a "version package" PR when changesets land on main - release.yml: publishes to npm with OIDC provenance when the version PR is merged Uses npm 11.6.4 for OIDC support. Requires npm-publish environment and NPM_TOKEN secret on the repo.
1 parent 19cb7dd commit 502a039

2 files changed

Lines changed: 76 additions & 17 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Changesets PR
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- ".changeset/**"
9+
- "src/**"
10+
- "package.json"
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
changesets-pr:
18+
if: github.repository == 'triggerdotdev/agentcrumbs'
19+
name: Create Release PR
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: write
23+
pull-requests: write
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- uses: pnpm/action-setup@v4
30+
with:
31+
version: 10
32+
33+
- uses: actions/setup-node@v4
34+
with:
35+
node-version: 22
36+
cache: pnpm
37+
38+
- run: pnpm install --frozen-lockfile
39+
40+
- name: Create Release PR
41+
uses: changesets/action@v1
42+
with:
43+
title: "chore: version package"
44+
commit: "chore: version package"
45+
version: pnpm changeset version
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
11
name: Release
22

33
on:
4-
push:
4+
pull_request:
5+
types:
6+
- closed
57
branches:
68
- main
79

8-
concurrency: ${{ github.workflow }}-${{ github.ref }}
9-
10-
permissions:
11-
contents: write
12-
pull-requests: write
13-
id-token: write
10+
concurrency:
11+
group: ${{ github.workflow }}
12+
cancel-in-progress: false
1413

1514
jobs:
1615
release:
17-
name: Release
16+
if: >
17+
github.repository == 'triggerdotdev/agentcrumbs' &&
18+
github.event.pull_request.merged == true &&
19+
github.event.pull_request.head.ref == 'changeset-release/main'
20+
name: Publish to npm
1821
runs-on: ubuntu-latest
22+
environment: npm-publish
23+
permissions:
24+
contents: write
25+
id-token: write
1926
steps:
2027
- uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
2130

2231
- uses: pnpm/action-setup@v4
2332
with:
@@ -29,20 +38,23 @@ jobs:
2938
cache: pnpm
3039
registry-url: https://registry.npmjs.org
3140

41+
# npm 11.5.1+ required for OIDC publishing
42+
- run: npm install -g npm@11.6.4
43+
3244
- run: pnpm install --frozen-lockfile
3345

3446
- run: pnpm build
3547

3648
- run: pnpm typecheck
3749

38-
- name: Create Release PR or Publish
39-
uses: changesets/action@v1
40-
with:
41-
title: "chore: version packages"
42-
commit: "chore: version packages"
43-
version: pnpm changeset version
44-
publish: pnpm changeset publish
50+
- name: Publish to npm
51+
run: pnpm changeset publish
4552
env:
46-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47-
NPM_CONFIG_PROVENANCE: true
4853
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
54+
NPM_CONFIG_PROVENANCE: true
55+
56+
- name: Create git tags
57+
run: |
58+
VERSION=$(node -p "require('./package.json').version")
59+
git tag "v${VERSION}"
60+
git push origin "v${VERSION}"

0 commit comments

Comments
 (0)