ctl-core 0.6.21

Shared clap chassis for the *ctl CLIs
Documentation
name: Publish

on:
  pull_request:
    types: [closed]
  workflow_dispatch:

permissions:
  contents: write

env:
  GIT_CONFIG_COUNT: "1"
  GIT_CONFIG_KEY_0: init.defaultBranch
  GIT_CONFIG_VALUE_0: main
  MISE_ENV: ci,release
  # A cache written off the default branch is scoped to that ref, so no
  # other run can read it back.
  CACHE_WRITE: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}

# One group for the runs that can publish, so a manual run and a release never
# run at the same time. Every other run gets a group of its own: a group keeps
# one pending run, and a no-op run would replace a waiting release. A newer
# publishing run still replaces a waiting one; re-run the replaced run to
# publish the version it carried.
concurrency:
  group: >-
    ${{ ((github.event_name == 'workflow_dispatch' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)) ||
         (github.event.pull_request.merged &&
          github.event.pull_request.base.ref == github.event.repository.default_branch &&
          github.event.pull_request.head.ref == 'version-packages'))
        && 'publish' || format('publish-noop-{0}', github.run_id) }}
  cancel-in-progress: false

jobs:
  publish:
    # A manual run publishes only from the default branch, never from an unmerged
    # branch.
    if: >-
      (github.event_name == 'workflow_dispatch' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)) ||
      (github.event.pull_request.merged &&
       github.event.pull_request.base.ref == github.event.repository.default_branch &&
       github.event.pull_request.head.ref == 'version-packages')
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
          ref: ${{ github.event.pull_request.merge_commit_sha || github.sha }}
      - name: Set up mise
        uses: jdx/mise-action@c2a87611a18de5b3828c5652fe268e992400cb5c # v4.3.0
        with:
          version: 2026.10.9
          cache: true
          cache_save: ${{ env.CACHE_WRITE }}
      - run: mise install --locked
      - uses: victor-software-house/verctl/actions/publish@c9f41e8df9746ad240cf59bc18626c0d938c7662 # v0.2.3
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}