name: publish-github-action

on:
  workflow_dispatch:
  push:
    tags:
      - "github-v*.*.*"
      - "!github-v1"

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
  contents: write

jobs:
  publish:
    runs-on: blacksmith-4vcpu-ubuntu-2404
    steps:
      - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
        with:
          fetch-depth: 0

      - run: git fetch --force --tags

      - name: Publish
        run: |
          git config --global user.email "opencode@sst.dev"
          git config --global user.name "opencode"
          ./script/publish
        working-directory: ./github