diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cdb4df9..4ca464c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,3 +1,4 @@ +# npm's trusted publisher names this file: keep its name. name: Release on: @@ -10,88 +11,14 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} jobs: - select-mode: - runs-on: ubuntu-latest - outputs: - mode: ${{ steps.select-mode.outputs.mode }} - publish-plan-artifact-id: ${{ steps.select-mode.outputs.publish-plan-artifact-id }} + release: + uses: whatsaaaa/template/.github/workflows/changesets-release.yml@v1 + # The version job starts ci.yml on the Version Packages pull request, through its + # workflow_dispatch trigger, since GitHub starts no pull_request run for it. The publish job + # runs in the npm environment, which the trusted publisher names, and each package's prepack + # builds it. Pre mode (.changeset/pre.json) picks the rc dist-tag. permissions: - contents: read - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - persist-credentials: false - - uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6 - - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7 - with: - node-version: 24 - package-manager-cache: false - - run: pnpm install --frozen-lockfile - - id: select-mode - uses: changesets/action/select-mode@v2 - - version: - if: needs.select-mode.outputs.mode == 'version' - needs: select-mode - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - persist-credentials: false - - uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6 - - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7 - with: - node-version: 24 - package-manager-cache: false - - run: pnpm install --frozen-lockfile - - uses: changesets/action/version@v2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # read by @changesets/changelog-github - - pack: - if: needs.select-mode.outputs.mode == 'publish' - needs: select-mode - runs-on: ubuntu-latest - outputs: - pack-dir-artifact-id: ${{ steps.pack.outputs.pack-dir-artifact-id }} - permissions: - contents: read - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - persist-credentials: false - - uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6 - - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7 - with: - node-version: 24 - package-manager-cache: false - - run: pnpm install --frozen-lockfile - - run: pnpm build - - id: pack - uses: changesets/action/pack@v2 - with: - publish-plan-artifact-id: ${{ needs.select-mode.outputs.publish-plan-artifact-id }} - - publish: - needs: pack - runs-on: ubuntu-latest - environment: npm # must match the trusted publisher; remove both or neither - permissions: - contents: write # git tags + GitHub releases + actions: write # starts CI on the Version Packages pull request + contents: write # Version Packages pull request, git tags and GitHub releases + pull-requests: write # Version Packages pull request id-token: write # npm OIDC - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - persist-credentials: false - - uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6 - - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7 - with: - node-version: 24 - package-manager-cache: false - - run: pnpm install --frozen-lockfile - - uses: changesets/action/publish@v2 - with: - pack-dir-artifact-id: ${{ needs.pack.outputs.pack-dir-artifact-id }}