|
| 1 | +name: Release @latest-v1 |
| 2 | + |
| 3 | +# Releases the maintenance line for consumers who are staying on the Next.js pages router. |
| 4 | +# |
| 5 | +# The reason this workflow exists at all: `changeset publish` tags `latest` by default, even when |
| 6 | +# publishing a *lower* version number. Once v2 is out, a v1 release from the default workflow would |
| 7 | +# silently move the `latest` dist-tag backwards, and every fresh `npm install @headstartwp/core` |
| 8 | +# would resolve to v1. This publishes under `latest-v1` instead, so the two lines coexist. |
| 9 | +# |
| 10 | +# Consumers pin the v1 line with: |
| 11 | +# npm install @headstartwp/core@latest-v1 |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: write |
| 15 | + pull-requests: write |
| 16 | + |
| 17 | +on: |
| 18 | + push: |
| 19 | + branches: |
| 20 | + - v1 |
| 21 | + workflow_dispatch: |
| 22 | + |
| 23 | +concurrency: ${{ github.workflow }}-${{ github.ref }} |
| 24 | + |
| 25 | +jobs: |
| 26 | + packages: |
| 27 | + name: Release |
| 28 | + runs-on: ubuntu-latest |
| 29 | + # Belt and braces: the trigger already restricts this, but a mis-fired workflow_dispatch on |
| 30 | + # another ref must not publish from it. |
| 31 | + if: github.ref == 'refs/heads/v1' |
| 32 | + steps: |
| 33 | + - name: Checkout Repo |
| 34 | + uses: actions/checkout@v4 |
| 35 | + with: |
| 36 | + # changesets needs the full history to work out what to release. |
| 37 | + fetch-depth: 0 |
| 38 | + |
| 39 | + - name: Setup Node.js |
| 40 | + uses: actions/setup-node@v4 |
| 41 | + with: |
| 42 | + node-version: 24.x |
| 43 | + |
| 44 | + - name: Install Dependencies |
| 45 | + run: npm ci |
| 46 | + |
| 47 | + - name: Create Release Pull Request or Publish to npm |
| 48 | + id: changesets |
| 49 | + uses: changesets/action@v1 |
| 50 | + with: |
| 51 | + # `publish:v1` differs from `publish` only in passing `--tag latest-v1`. |
| 52 | + publish: npm run publish:v1 |
| 53 | + version: npm run version |
| 54 | + title: 'Release v1 (@latest-v1)' |
| 55 | + commit: 'chore: version packages (v1)' |
| 56 | + env: |
| 57 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 58 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 59 | + |
| 60 | +# Deliberately no `plugin-release` job. The WordPress plugin is published from trunk and develop |
| 61 | +# only; the v1 line ships npm packages, and pushing the plugin from here would race those branches |
| 62 | +# for the same target repository. |
0 commit comments