-
Notifications
You must be signed in to change notification settings - Fork 132
86 lines (74 loc) · 2.25 KB
/
release.yml
File metadata and controls
86 lines (74 loc) · 2.25 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
81
82
83
84
85
86
name: Release
on:
push:
branches:
- master
pull_request:
types: [closed]
branches:
- master
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
# Job 1: Create/update Version PR (on push to master)
version:
if: github.event_name == 'push'
name: Create Version PR
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install Dependencies
run: npm i
- name: Create Release Pull Request
uses: changesets/action@v1
with:
title: "Version Packages"
commit: "Version Packages"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Job 2: Publish to npm (when Version PR is merged)
publish:
if: github.event_name == 'pull_request' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.title, 'Version Packages')
name: Publish to npm
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: "https://registry.npmjs.org"
- name: Upgrade npm for OIDC support
run: npm install -g npm@latest
- name: Install Dependencies
run: npm i
- name: Build packages
run: npm run build
- name: Publish to npm
uses: changesets/action@v1
with:
publish: npx changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Clear tokens to allow OIDC authentication
# https://github.com/orgs/community/discussions/176761
# https://github.com/changesets/changesets/issues/1152
NODE_AUTH_TOKEN: ""
NPM_TOKEN: ""