name: Release

on:
    push:
        branches:
            - main

jobs:
    release:
        if: github.repository == 'REPO_NAME'
        name: Release
        runs-on: ubuntu-latest
        permissions:
            id-token: write
            contents: write
            pull-requests: write
        steps:
            - name: Checkout
              uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
              with:
                  # This makes Actions fetch all Git history so that Changesets
                  # can generate changelogs with the correct commits.
                  fetch-depth: 0

            - name: Setup PNPM
              uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8

            - name: Setup Node 24
              uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
              with:
                  node-version: 24
                  registry-url: https://registry.npmjs.org/
                  cache: pnpm

            - name: Install
              run: pnpm install --frozen-lockfile

            # - name: Build
            #   run: pnpm build

            - name: Create Release Pull Request
              uses: changesets/action@63a615b9cd06ba9a3e6d13796c7fbcb080a60a0b # v1.8.0
              with:
                  publish: pnpm changeset publish
              env:
                  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
                  NPM_CONFIG_PROVENANCE: true
