Skip to content

🚒 Release

🚒 Release #789

Workflow file for this run

# 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:
#
# - Changesets-driven pre-releases/stable releases
# - Trigger: push to release-next/release-v6 branch
# - jobs: release -> find_package_version -> comment
# - Nightly releases
# - Trigger: schedule/cron
# - jobs: release-nightly
# - Experimental releases (from a workflow_dispatch trigger)
# - Trigger: workflow_dispatch
# - jobs: release-experimental
name: 🚒 Release
on:
# Changesets-driven prereleases and stable releases
push:
branches:
- "release-next"
- "release-v6"
# Nightly releases
schedule:
- cron: "0 7 * * *" # every day at 12AM PST
# Experimental Releases
workflow_dispatch:
inputs:
branch:
required: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CI: true
jobs:
release:
name: πŸ¦‹ Changesets Release
if: github.repository == 'remix-run/react-router' && github.event_name == 'push'
runs-on: ubuntu-latest
outputs:
published_packages: ${{ steps.changesets.outputs.publishedPackages }}
published: ${{ steps.changesets.outputs.published }}
permissions:
contents: write # enable pushing changes to the origin
id-token: write # enable generation of an ID token for publishing
pull-requests: write # enable opening a PR for the release
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: πŸ“¦ Setup pnpm
uses: pnpm/action-setup@v4
- name: βŽ” Setup node
uses: actions/setup-node@v6
with:
node-version: 24 # Needed for npm@11 for Trusted Publishing
cache: "pnpm"
- name: πŸ“₯ Install deps
run: pnpm install --frozen-lockfile
# This action has two responsibilities. The first time the workflow runs
# (initial push to a `release-*` branch) it will create a new branch and
# then open a PR with the related changes for the new version. After the
# PR is merged, the workflow will run again and this action will build +
# publish to npm.
- name: πŸš€ PR / Publish
id: changesets
# PLEASE KEEP THIS PINNED TO 1.4.10 to avoid a regression in 1.5.*
# See https://github.com/changesets/action/issues/465
uses: changesets/[email protected]
with:
version: pnpm run changeset:version
commit: "chore: Update version for release"
title: "chore: Update version for release"
publish: pnpm run release
createGithubReleases: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
find_package_version:
name: πŸ¦‹ Find Package
needs: [release]
runs-on: ubuntu-latest
if: github.repository == 'remix-run/react-router' && github.event_name == 'push' && github.ref_name != 'release-v6' && needs.release.outputs.published == 'true'
outputs:
package_version: ${{ steps.find_package_version.outputs.package_version }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v5
- name: πŸ“¦ Setup pnpm
uses: pnpm/action-setup@v4
- name: βŽ” Setup node
uses: actions/setup-node@v6
with:
node-version: 24 # Needed for npm@11 for Trusted Publishing
cache: "pnpm"
- id: find_package_version
run: |
package_version=$(node ./scripts/find-release-from-changeset.js)
echo "package_version=${package_version}" >> $GITHUB_OUTPUT
env:
PACKAGE_VERSION_TO_FOLLOW: "react-router"
PUBLISHED_PACKAGES: ${{ needs.release.outputs.published_packages }}
comment:
name: πŸ“ Comment on related issues and pull requests
if: github.repository == 'remix-run/react-router' && github.event_name == 'push' && github.ref_name != 'release-v6' && needs.find_package_version.outputs.package_version != ''
needs: [release, find_package_version]
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@v5
with:
fetch-depth: 0
- name: πŸ“ Comment on related issues and pull requests
uses: remix-run/[email protected]
with:
DIRECTORY_TO_CHECK: "./packages"
PACKAGE_NAME: "react-router"
ISSUE_LABELS_TO_REMOVE: "awaiting release"
# HEADS UP! this "nightly" job will only ever run on the `main` branch due to
# it being a cron job, and the last commit on main will be what github shows
# as the trigger however in the checkout below we specify the `dev` branch,
# so all the scripts in this job will be ran from that, confusing i know, so
# in some cases we'll need to create multiple PRs when modifying nightly
# release processes
release-nightly:
name: πŸŒ’ Nightly Release
if: github.repository == 'remix-run/react-router' && github.event_name == 'schedule'
runs-on: ubuntu-latest
permissions:
contents: write # enable pushing changes to the origin
id-token: write # enable generation of an ID token for publishing
outputs:
# will be undefined if there's no release necessary
NEXT_VERSION: ${{ steps.version.outputs.NEXT_VERSION }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v5
with:
ref: dev
# 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@v4
- name: βŽ” Setup node
uses: actions/setup-node@v6
with:
node-version: 24 # Needed for npm@11 for Trusted Publishing
cache: "pnpm"
- name: πŸ“₯ Install deps
run: pnpm install --frozen-lockfile
- name: πŸ•΅οΈ Check for changes
id: version
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
# get latest nightly tag
LATEST_NIGHTLY_TAG=$(git tag -l v0.0.0-nightly-\* --sort=-creatordate | head -n 1)
# check if last commit to dev starts with the nightly tag we're about
# to create (minus the date)
# if it is, we'll skip the nightly creation
# if not, we'll create a new nightly tag
if [[ ${LATEST_NIGHTLY_TAG} == v0.0.0-nightly-${SHORT_SHA}-* ]]; then
echo "πŸ›‘ Latest nightly tag is the same as the latest commit sha, skipping nightly release"
else
# yyyyMMdd format (e.g. 20221207)
DATE=$(date '+%Y%m%d')
# v0.0.0-nightly-<short sha>-<date>
NEXT_VERSION=0.0.0-nightly-${SHORT_SHA}-${DATE}
# set output so it can be used in other jobs
echo "NEXT_VERSION=${NEXT_VERSION}" >> $GITHUB_OUTPUT
fi
- name: ‴️ Update version
if: steps.version.outputs.NEXT_VERSION
run: |
git config --local user.email "[email protected]"
git config --local user.name "Remix Run Bot"
git checkout -b nightly/${{ steps.version.outputs.NEXT_VERSION }}
pnpm run version ${{steps.version.outputs.NEXT_VERSION}}
git push origin --tags
- name: πŸ— Build
if: steps.version.outputs.NEXT_VERSION
run: pnpm build
- name: πŸš€ Publish
if: steps.version.outputs.NEXT_VERSION
run: pnpm run publish
release-experimental:
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@v5
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@v4
- name: βŽ” Setup node
uses: actions/setup-node@v6
with:
node-version: 24 # Needed for npm@11 for Trusted Publishing
cache: "pnpm"
- name: πŸ“₯ Install deps
run: pnpm install --frozen-lockfile
- name: ‴️ Update version
run: |
git config --local user.email "[email protected]"
git config --local user.name "Remix Run Bot"
SHORT_SHA=$(git rev-parse --short HEAD)
NEXT_VERSION=0.0.0-experimental-${SHORT_SHA}
git checkout -b experimental/${NEXT_VERSION}
pnpm run version ${NEXT_VERSION}
git push origin --tags
- name: πŸ— Build
run: pnpm build
- name: πŸš€ Publish
run: pnpm run publish