chore: format #176
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/v7 branches) | |
| # - Experimental releases (from a workflow_dispatch trigger) | |
| name: Release | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| - "hotfix" | |
| - "v7" | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| required: true | |
| description: Experimental release branch | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| # Don't cancel in-progress runs - once a release flow has started we want it | |
| # to run all the way through so subsequent commits (like formatting) don't | |
| # interrupt publishing/commenting | |
| cancel-in-progress: false | |
| 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@v7 | |
| - 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 | |
| issues: write # enable applying labels to the release PR | |
| pull-requests: write # enable opening a PR for the release | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.ref_name }} | |
| fetch-depth: 0 | |
| token: ${{ secrets.FORMAT_PAT }} | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v6 | |
| - name: Install Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: ".nvmrc" | |
| 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@v7 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v6 | |
| - name: Setup node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: ".nvmrc" | |
| 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 --branch=${{ github.ref_name }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| comment: | |
| name: Comment on released issues/pull requests | |
| needs: publish | |
| # Only comment on issues/PRs for latest releases from main. | |
| if: github.ref_name == 'main' | |
| 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@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v6 | |
| - name: Setup node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: ".nvmrc" | |
| 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@v7 | |
| 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-file: ".nvmrc" | |
| 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 |