Drop dev branch from workflows/docs (#15148) #159
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 main/hotfix branches) | |
| # - Experimental releases (from a workflow_dispatch trigger) | |
| name: π’ Release/Publish | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| - "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 }} | |
| should_publish: ${{ steps.needs-publish.outputs.should_publish }} | |
| 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." | |
| echo "has_change_files=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: needs-publish | |
| id: needs-publish | |
| if: steps.check.outputs.has_change_files == 'false' | |
| run: | | |
| version=$(node -p "require('./packages/react-router/package.json').version") | |
| published_version=$(npm view "react-router@$version" version || true) | |
| if [ "$published_version" = "$version" ]; then | |
| echo "react-router@$version is already published. Skipping publish." | |
| echo "should_publish=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "react-router@$version is not published yet. Publishing is needed." | |
| echo "should_publish=true" >> $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: | |
| ref: ${{ github.ref_name }} | |
| 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.should_publish == 'true' | |
| 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 |