Skip to content

Commit 0af95d4

Browse files
Update Changesets and experimental release flow (#11442)
1 parent 38e986f commit 0af95d4

File tree

10 files changed

+166
-675
lines changed

10 files changed

+166
-675
lines changed

.changeset/config.json

+11-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,22 @@
1010
"react-router",
1111
"react-router-dom",
1212
"react-router-dom-v5-compat",
13-
"react-router-native"
13+
"react-router-native",
14+
"@react-router/dev",
15+
"@react-router/express",
16+
"@react-router/node",
17+
"@react-router/serve",
18+
"@react-router/server-runtime",
19+
"@react-router/testing"
1420
]
1521
],
1622
"linked": [],
1723
"access": "public",
1824
"baseBranch": "dev",
1925
"updateInternalDependencies": "patch",
2026
"bumpVersionsWithWorkspaceProtocolOnly": true,
21-
"ignore": []
27+
"ignore": ["integration", "integration-*"],
28+
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
29+
"onlyUpdatePeerDependentsWhenOutOfRange": true
30+
}
2231
}

.github/workflows/release-experimental.yml

+22-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
1-
name: 🚀 Release (experimental)
1+
name: 🧪 Experimental Release
2+
23
on:
3-
push:
4-
tags:
5-
- "v0.0.0-experimental*"
4+
workflow_dispatch:
5+
inputs:
6+
branch:
7+
required: true
68

79
concurrency: ${{ github.workflow }}-${{ github.ref }}
810

911
env:
1012
CI: true
1113

1214
jobs:
13-
release:
14-
name: 🧑‍🔬 Experimental Release
15-
if: |
16-
github.repository == 'remix-run/react-router' &&
17-
contains(github.ref, 'experimental')
15+
experimental:
16+
name: 🧪 Experimental Release
17+
if: github.repository == 'remix-run/react-router'
1818
runs-on: ubuntu-latest
1919
steps:
2020
- name: ⬇️ Checkout repo
2121
uses: actions/checkout@v4
2222
with:
23+
ref: ${{ github.event.inputs.branch }}
24+
# checkout using a custom token so that we can push later on
25+
token: ${{ secrets.NIGHTLY_PAT }}
2326
fetch-depth: 0
2427

2528
- name: 📦 Setup pnpm
@@ -34,6 +37,16 @@ jobs:
3437
- name: 📥 Install deps
3538
run: pnpm install --frozen-lockfile
3639

40+
- name: ⤴️ Update version
41+
run: |
42+
git config --local user.email "[email protected]"
43+
git config --local user.name "Remix Run Bot"
44+
SHORT_SHA=$(git rev-parse --short HEAD)
45+
NEXT_VERSION=0.0.0-experimental-${SHORT_SHA}
46+
git checkout -b experimental/${NEXT_VERSION}
47+
pnpm run version ${NEXT_VERSION}
48+
git push origin --tags
49+
3750
- name: 🏗 Build
3851
run: pnpm build
3952

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
id: changesets
5454
uses: changesets/action@v1
5555
with:
56-
version: pnpm run version
56+
version: pnpm run changeset:version
5757
commit: "chore: Update version for release"
5858
title: "chore: Update version for release"
5959
publish: pnpm run release

DEVELOPMENT.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,12 @@ Hotfix releases follow the same process as standard releases above, but the `rel
6767

6868
### Experimental releases
6969

70-
Experimental releases and hot-fixes do not need to be branched off of `dev`. Experimental releases can be branched from anywhere as they are not intended for general use.
71-
72-
- Create a new branch for the release: `git checkout -b release-experimental`
73-
- Make whatever changes you need and commit them: `git add . && git commit "experimental changes!"`
74-
- Update version numbers and create a release tag: `pnpm run version:experimental`
75-
- Push to GitHub: `git push origin --follow-tags`
76-
- The CI workflow should automatically trigger from the experimental tag to publish the release to npm
70+
Experimental releases use a [manually-triggered Github Actions workflow](./.github/workflows/release-experimental.yml) and can be built from any existing branch. to build and publish an experimental release:
71+
72+
- Commit your changes to a branch
73+
- Push the branch to github
74+
- Go to the Github Actions UI for the [release-experimental.yml workflow](https://github.com/remix-run/react-router/actions/workflows/release-experimental.yml)
75+
- Click the `Run workflow` dropdown
76+
- Leave the `Use workflow from` dropdown as `main`
77+
- Enter your feature branch in the `branch` input
78+
- Click the `Run workflow` button

docs/guides/contributing.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ git checkout -b release/v6.1.0
133133

134134
# Create a new tag and update version references throughout the
135135
# codebase.
136-
pnpm run version minor # | "patch" | "major"
136+
pnpm run version [nextVersion]
137137

138138
# Push the release branch along with the new release tag.
139139
git push origin release/v6.1.0 --follow-tags
@@ -164,7 +164,7 @@ pnpm install && pnpm build && pnpm test
164164

165165
# Assuming the tests pass, create the release tag and update
166166
# version references throughout the codebase.
167-
pnpm run version patch
167+
pnpm run version [nextVersion]
168168

169169
# Push changes along with the new release tag.
170170
git push origin main --follow-tags

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
"posttest:integration": "pnpm clean:integration",
1919
"playwright:integration": "playwright test --config ./integration/playwright.config.ts",
2020
"changeset": "changeset",
21-
"version": "changeset version && node ./scripts/remove-prerelease-changelogs.mjs",
21+
"changeset:version": "changeset version && node ./scripts/remove-prerelease-changelogs.mjs",
2222
"publish": "node scripts/publish.js",
23-
"version:experimental": "node ./scripts/version experimental",
23+
"version": "node ./scripts/version",
2424
"watch": "rollup -c -w"
2525
},
2626
"jest": {
@@ -99,7 +99,6 @@
9999
"jest-environment-jsdom": "^29.6.2",
100100
"jsonfile": "^6.1.0",
101101
"prettier": "^2.8.8",
102-
"prompt-confirm": "^2.0.4",
103102
"react": "^18.2.0",
104103
"react-dom": "^18.2.0",
105104
"react-test-renderer": "^18.2.0",
@@ -144,7 +143,8 @@
144143
},
145144
"pnpm": {
146145
"patchedDependencies": {
147-
"@changesets/[email protected]": "patches/@[email protected]"
146+
"@changesets/[email protected]": "patches/@[email protected]",
147+
"@changesets/[email protected]": "patches/@[email protected]"
148148
}
149149
}
150150
}

patches/@[email protected]

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
diff --git a/dist/assemble-release-plan.cjs.dev.js b/dist/assemble-release-plan.cjs.dev.js
2+
index e1376ca756d69816f8c79637ee7b45161f092167..d9dc4c17cc90bc31794956a603f0baf6c5fee0d9 100644
3+
--- a/dist/assemble-release-plan.cjs.dev.js
4+
+++ b/dist/assemble-release-plan.cjs.dev.js
5+
@@ -257,7 +257,7 @@ function shouldBumpMajor({
6+
// we check if it is a peerDependency because if it is, our dependent bump type might need to be major.
7+
return depType === "peerDependencies" && nextRelease.type !== "none" && nextRelease.type !== "patch" && ( // 1. If onlyUpdatePeerDependentsWhenOutOfRange set to true, bump major if the version is leaving the range.
8+
// 2. If onlyUpdatePeerDependentsWhenOutOfRange set to false, bump major regardless whether or not the version is leaving the range.
9+
- !onlyUpdatePeerDependentsWhenOutOfRange || !semverSatisfies__default['default'](incrementVersion(nextRelease, preInfo), versionRange)) && ( // bump major only if the dependent doesn't already has a major release.
10+
+ !onlyUpdatePeerDependentsWhenOutOfRange || !semverSatisfies__default['default'](incrementVersion(nextRelease, preInfo), versionRange, { includePrerelease: true })) && ( // bump major only if the dependent doesn't already has a major release.
11+
!releases.has(dependent) || releases.has(dependent) && releases.get(dependent).type !== "major");
12+
}
13+
14+
diff --git a/dist/assemble-release-plan.cjs.prod.js b/dist/assemble-release-plan.cjs.prod.js
15+
index 3a83720644a94cdf6e62fa188a72c51c0384d00e..b3ce3ce688c16cafe92fc16569a7850ea644b904 100644
16+
--- a/dist/assemble-release-plan.cjs.prod.js
17+
+++ b/dist/assemble-release-plan.cjs.prod.js
18+
@@ -130,7 +130,7 @@ function getDependencyVersionRanges(dependentPkgJSON, dependencyRelease) {
19+
}
20+
21+
function shouldBumpMajor({dependent: dependent, depType: depType, versionRange: versionRange, releases: releases, nextRelease: nextRelease, preInfo: preInfo, onlyUpdatePeerDependentsWhenOutOfRange: onlyUpdatePeerDependentsWhenOutOfRange}) {
22+
- return "peerDependencies" === depType && "none" !== nextRelease.type && "patch" !== nextRelease.type && (!onlyUpdatePeerDependentsWhenOutOfRange || !semverSatisfies__default.default(incrementVersion(nextRelease, preInfo), versionRange)) && (!releases.has(dependent) || releases.has(dependent) && "major" !== releases.get(dependent).type);
23+
+ return "peerDependencies" === depType && "none" !== nextRelease.type && "patch" !== nextRelease.type && (!onlyUpdatePeerDependentsWhenOutOfRange || !semverSatisfies__default.default(incrementVersion(nextRelease, preInfo), versionRange, { includePrerelease: true })) && (!releases.has(dependent) || releases.has(dependent) && "major" !== releases.get(dependent).type);
24+
}
25+
26+
function flattenReleases(changesets, packagesByName, ignoredPackages) {
27+
diff --git a/dist/assemble-release-plan.esm.js b/dist/assemble-release-plan.esm.js
28+
index 62891eb5dee97a33e6587514267c3cde5b314830..d183129242ce8582ce2e7a40d507b46f51583427 100644
29+
--- a/dist/assemble-release-plan.esm.js
30+
+++ b/dist/assemble-release-plan.esm.js
31+
@@ -246,7 +246,7 @@ function shouldBumpMajor({
32+
// we check if it is a peerDependency because if it is, our dependent bump type might need to be major.
33+
return depType === "peerDependencies" && nextRelease.type !== "none" && nextRelease.type !== "patch" && ( // 1. If onlyUpdatePeerDependentsWhenOutOfRange set to true, bump major if the version is leaving the range.
34+
// 2. If onlyUpdatePeerDependentsWhenOutOfRange set to false, bump major regardless whether or not the version is leaving the range.
35+
- !onlyUpdatePeerDependentsWhenOutOfRange || !semverSatisfies(incrementVersion(nextRelease, preInfo), versionRange)) && ( // bump major only if the dependent doesn't already has a major release.
36+
+ !onlyUpdatePeerDependentsWhenOutOfRange || !semverSatisfies(incrementVersion(nextRelease, preInfo), versionRange, { includePrerelease: true })) && ( // bump major only if the dependent doesn't already has a major release.
37+
!releases.has(dependent) || releases.has(dependent) && releases.get(dependent).type !== "major");
38+
}
39+

0 commit comments

Comments
 (0)