sailfork / t3code-github / .repos/ effect/ .github/ workflows/ release.yml

name: Release
on:
  push:
    branches: [main]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: false # Prevent newer push from interrupting active release

permissions: {}

jobs:
  release:
    if: github.repository_owner == 'Effect-Ts'
    name: Release
    runs-on: ubuntu-latest
    timeout-minutes: 30
    permissions:
      contents: write
      pull-requests: write
      id-token: write
    steps:
      - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
        with:
          # This is required to ensure the `GITHUB_TOKEN` we provide below is
          # **always** used when pushing updates to the changesets release branch.
          # Otherwise the default token will be used, and actions on that versioned
          # release branch will not be triggered.
          persist-credentials: false
      - name: Install dependencies
        uses: ./.github/actions/setup
      - name: Upgrade npm for OIDC support
        run: npm install -g npm@11
      - name: Create Release Pull Request or Publish
        id: changesets
        uses: changesets/action@d0ee272882939fa35f22d979828acb7e61e0bd47 # v2.0.0-next.4
        with:
          version-script: pnpm changeset-version
          publish-script: pnpm changeset-publish
          # Use a personal access token instead of the one that GitHub generates
          # automatically to ensure workflows get triggered on the changesets
          # release branch.
          github-token: ${{ secrets.CHANGESET_GITHUB_TOKEN }}
      # Packages are published under the `staging` dist-tag. The npm promote
      # workflow moves `latest` once npm serves every package, then deploys the
      # website.