-
Notifications
You must be signed in to change notification settings - Fork 35
80 lines (67 loc) · 2.6 KB
/
Copy pathrelease.yml
File metadata and controls
80 lines (67 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Release
on:
push:
branches: [main]
workflow_dispatch: # Manual trigger
env:
HUSKY_SKIP: true
# Skip when the head commit is the workflow's own version-bump commit, to avoid loops.
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write # create the "Version Packages" PR and tags
pull-requests: write # open/update the version PR
id-token: write # REQUIRED for npm OIDC trusted publishing
jobs:
release:
runs-on: ubuntu-latest
if: github.event_name != 'push' || !contains(github.event.head_commit.message, 'skip ci')
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- name: Setup node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24.21.0
registry-url: https://registry.npmjs.org
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm run build
- name: Detect auth mode (OIDC vs token)
env:
NPM_BOOTSTRAP_TOKEN: ${{ secrets.NPM_BOOTSTRAP_TOKEN }}
run: |
if [ -n "$NPM_BOOTSTRAP_TOKEN" ]; then
echo "::warning::NPM bootstrap token is configured; token-based auth will be used (OIDC will not be exercised)."
else
echo "No NPM bootstrap token configured; using OIDC trusted publishing."
fi
- name: Configure NPM bootstrap token (non OIDC flow)
env:
NPM_BOOTSTRAP_TOKEN: ${{ secrets.NPM_BOOTSTRAP_TOKEN }}
if: ${{ env.NPM_BOOTSTRAP_TOKEN != '' }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_BOOTSTRAP_TOKEN}" >> ~/.npmrc
- name: Setup git user
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@ae32849d5ba541f9ae29e40e22a623bc13562f51 # v2.1.2
with:
version-script: pnpm run version-packages
publish-script: pnpm run release-publish
commit-message: "chore(release): publish"
pr-title: "chore(release): publish"
github-token: ${{ secrets.GITHUB_TOKEN }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_BOOTSTRAP_TOKEN }}
NPM_CONFIG_PROVENANCE: "true"