forked from remix-run/react-router
-
Notifications
You must be signed in to change notification settings - Fork 0
185 lines (157 loc) Β· 5.44 KB
/
release.yml
File metadata and controls
185 lines (157 loc) Β· 5.44 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# We use this singular file for all of our releases because we can only specify
# a singular GitHub workflow file in npm's Trusted Publishing configuration.
# See https://docs.npmjs.com/trusted-publishers for more info.
#
# Specific jobs only run on the proper trigger:
#
# - Change file driven stable releases (push to release/hotfix branches)
# - Experimental releases (from a workflow_dispatch trigger)
name: π’ Release/Publish
on:
push:
branches:
- "release"
- "hotfix"
workflow_dispatch:
inputs:
branch:
required: true
description: Experimental release branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
name: Check release readiness
if: github.repository == 'remix-run/react-router' && github.event_name == 'push'
runs-on: ubuntu-latest
outputs:
has_change_files: ${{ steps.check.outputs.has_change_files }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Check for change files
id: check
run: |
# Look for change files in any package's .changes directory (excluding README.md)
change_files=$(find packages/*/.changes -name "*.md" ! -name "README.md" 2>/dev/null)
if [ -n "$change_files" ]; then
echo "Change files found (blocking publish):"
echo "$change_files"
echo "has_change_files=true" >> $GITHUB_OUTPUT
else
echo "No change files found, proceeding to publish."
echo "has_change_files=false" >> $GITHUB_OUTPUT
fi
pull_request:
name: Open pull request
needs: check
if: needs.check.outputs.has_change_files == 'true'
runs-on: ubuntu-latest
permissions:
contents: write # enable pushing changes to the origin
pull-requests: write # enable opening a PR for the release
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.FORMAT_PAT }}
- name: Install pnpm
uses: pnpm/action-setup@v5
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 24 # Needed to run typescript scripts directly
package-manager-cache: false
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Update PR
run: pnpm changes:pr
env:
GITHUB_TOKEN: ${{ secrets.FORMAT_PAT }}
publish:
name: Publish
needs: check
if: needs.check.outputs.has_change_files == 'false'
runs-on: ubuntu-latest
permissions:
contents: write # enable pushing changes to the origin
id-token: write # enable generation of an ID token for publishing
steps:
- name: β¬οΈ Checkout repo
uses: actions/checkout@v6
- name: π¦ Setup pnpm
uses: pnpm/action-setup@v6
- name: β Setup node
uses: actions/setup-node@v6
with:
node-version: 24 # Needed for npm@11 for Trusted Publishing
package-manager-cache: false
- name: π₯ Install deps
run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm build
- name: Publish to npm and create releases
run: pnpm changes:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
comment:
name: π Comment on released issues/pull requests
needs: publish
runs-on: ubuntu-latest
permissions:
issues: write # enable commenting on released issues
pull-requests: write # enable commenting on released pull requests
steps:
- name: β¬οΈ Checkout repo
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: π¦ Setup pnpm
uses: pnpm/action-setup@v6
- name: β Setup node
uses: actions/setup-node@v6
with:
node-version: 24 # Needed for node TS support
package-manager-cache: false
- name: π₯ Install deps
run: pnpm install --frozen-lockfile
- name: π Comment on released issues and pull requests
env:
GH_TOKEN: ${{ github.token }}
run: pnpm run release-comments
experimental-release:
name: π§ͺ Experimental Release
if: github.repository == 'remix-run/react-router' && github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: write # enable pushing changes to the origin
id-token: write # enable generation of an ID token for publishing
steps:
- name: β¬οΈ Checkout repo
uses: actions/checkout@v6
with:
ref: ${{ github.event.inputs.branch }}
# checkout using a custom token so that we can push later on
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: π¦ Setup pnpm
uses: pnpm/action-setup@v6
- name: β Setup node
uses: actions/setup-node@v6
with:
node-version: 24 # Needed for npm@11 for Trusted Publishing
package-manager-cache: false
- name: π₯ Install deps
run: pnpm install --frozen-lockfile
- name: β€΄οΈ Update version
run: |
git config --local user.email "hello@remix.run"
git config --local user.name "Remix Run Bot"
pnpm run experimental:version
git push origin --tags
- name: π Build
run: pnpm build
- name: π Publish
run: pnpm run experimental:publish