name: Release

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  release:
    runs-on: ubuntu-latest
    name: Release
    if: "!contains(github.event.head_commit.message, 'skip ci')"
    permissions:
      contents: write
      issues: write
      pull-requests: write
      id-token: write
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
          token: ${{ secrets.GH_TOKEN }}
      - uses: actions/setup-node@v4
        with:
          node-version: 24.x
          registry-url: 'https://registry.npmjs.org'
      - name: Install dependencies
        run: yarn install --frozen-lockfile
      - name: Lint
        run: yarn run lint
      - name: Test
        run: yarn test
      - name: Build
        run: yarn build
      - name: Release
        env:
          GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
          NPM_CONFIG_PROVENANCE: 'true'
        run: npx semantic-release
