Skip to content

Commit 0328043

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

File tree

3 files changed

+74
-23
lines changed

3 files changed

+74
-23
lines changed

.github/workflows/canary.yaml

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

.github/workflows/release.yaml

Lines changed: 73 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,75 @@ 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/[email protected]
40+
with:
41+
run_install: false
42+
43+
- name: Setup Node.js
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: 24
47+
cache: 'pnpm'
48+
registry-url: 'https://registry.npmjs.org'
49+
50+
- name: Ensure npm supports OIDC trusted publishing
51+
run: npm install -g npm@latest
52+
53+
- name: Setup pnpm store
54+
id: pnpm-store
55+
run: |
56+
echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
57+
58+
- name: Setup pnpm cache
59+
uses: actions/cache@v4
60+
with:
61+
path: ${{ steps.pnpm-store.outputs.STORE_PATH }}
62+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
63+
restore-keys: |
64+
${{ runner.os }}-pnpm-store-
65+
66+
- name: Install Dependencies
67+
run: pnpm i --frozen-lockfile
68+
69+
- name: Create snapshot versions
70+
run: pnpm exec changeset version --snapshot canary
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
74+
- name: Build
75+
run: pnpm run build
76+
77+
- name: Publish canary
78+
run: pnpm exec changeset publish --no-git-tag --tag canary
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
1482
release:
1583
name: Release
1684
runs-on: ubuntu-latest
85+
if: ${{ github.event_name == 'push' }}
1786
steps:
1887
- name: Checkout
1988
uses: actions/checkout@v4
@@ -29,17 +98,18 @@ jobs:
2998
- name: Setup Node.js
3099
uses: actions/setup-node@v4
31100
with:
32-
node-version: 22
101+
node-version: 24
33102
cache: 'pnpm'
34103

35104
- name: Setup pnpm store
105+
id: pnpm-store
36106
run: |
37-
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
107+
echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
38108
39109
- name: Setup pnpm cache
40110
uses: actions/cache@v4
41111
with:
42-
path: ${{ env.STORE_PATH }}
112+
path: ${{ steps.pnpm-store.outputs.STORE_PATH }}
43113
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
44114
restore-keys: |
45115
${{ 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)