Skip to content

Commit 267861b

Browse files
committed
chore(ci): combine workflow files for NPM Trusted Publisher
1 parent 6063570 commit 267861b

3 files changed

Lines changed: 75 additions & 23 deletions

File tree

.github/workflows/canary.yaml

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

.github/workflows/release.yaml

Lines changed: 74 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Release
22

33
on:
4+
pull_request:
5+
branches:
6+
- main
47
push:
58
paths-ignore:
69
- 'docs/**'
@@ -11,9 +14,76 @@ on:
1114
- main
1215

1316
jobs:
17+
release-canary:
18+
name: Canary Release
19+
runs-on: ubuntu-24.04
20+
permissions:
21+
contents: read
22+
id-token: write
23+
if: >-
24+
${{
25+
github.event_name == 'pull_request' &&
26+
github.event.pull_request.head.repo.full_name == github.repository &&
27+
github.actor != 'dependabot[bot]' &&
28+
github.actor != 'dependabot-preview[bot]' &&
29+
github.actor != 'renovate[bot]'
30+
}}
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
ref: ${{ github.event.pull_request.head.sha }}
37+
38+
- name: Setup pnpm
39+
uses: pnpm/action-setup@v4.1.0
40+
with:
41+
version: 10.16.0
42+
run_install: false
43+
44+
- name: Setup Node.js
45+
uses: actions/setup-node@v4
46+
with:
47+
node-version: 24
48+
cache: 'pnpm'
49+
registry-url: 'https://registry.npmjs.org'
50+
51+
- name: Ensure npm supports OIDC trusted publishing
52+
run: npm install -g npm@latest
53+
54+
- name: Setup pnpm store
55+
id: pnpm-store
56+
run: |
57+
echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
58+
59+
- name: Setup pnpm cache
60+
uses: actions/cache@v4
61+
with:
62+
path: ${{ steps.pnpm-store.outputs.STORE_PATH }}
63+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
64+
restore-keys: |
65+
${{ runner.os }}-pnpm-store-
66+
67+
- name: Install Dependencies
68+
run: pnpm i --frozen-lockfile
69+
70+
- name: Create snapshot versions
71+
run: pnpm changeset version --snapshot canary
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
75+
- name: Build
76+
run: pnpm run build
77+
78+
- name: Publish canary
79+
run: pnpm changeset publish --no-git-tag --tag canary
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
1483
release:
1584
name: Release
1685
runs-on: ubuntu-latest
86+
if: ${{ github.event_name == 'push' }}
1787
steps:
1888
- name: Checkout
1989
uses: actions/checkout@v4
@@ -29,17 +99,18 @@ jobs:
2999
- name: Setup Node.js
30100
uses: actions/setup-node@v4
31101
with:
32-
node-version: 22
102+
node-version: 24
33103
cache: 'pnpm'
34104

35105
- name: Setup pnpm store
106+
id: pnpm-store
36107
run: |
37-
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
108+
echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
38109
39110
- name: Setup pnpm cache
40111
uses: actions/cache@v4
41112
with:
42-
path: ${{ env.STORE_PATH }}
113+
path: ${{ steps.pnpm-store.outputs.STORE_PATH }}
43114
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
44115
restore-keys: |
45116
${{ runner.os }}-pnpm-store-

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
runs-on: ${{ matrix.os }}
2828
strategy:
2929
matrix:
30-
node-version: [20, 22]
30+
node-version: [20, 22, 24]
3131
os: [ubuntu-latest]
3232
steps:
3333
- name: Checkout

0 commit comments

Comments
 (0)