name: Release Channel

# workflow_dispatch: use workflow from `main` for latest publish logic; checkout ref is always `release`.
on:
  push:
    branches: [release]
    # Same nix-refresh loop as next.yml — ignore lock-only merges from verify-nix PRs.
    paths-ignore:
      - "flake.lock"
      - "nix/**"
  workflow_dispatch:
    inputs:
      source_only:
        description: "Create/refresh tagged release only (skip platform builds and verify-nix)"
        required: false
        default: false
        type: boolean

jobs:
  publish-release:
    uses: ./.github/workflows/reusable-channel-publish.yml
    with:
      channel: release
      source_ref: release
      target_branch: release
      prerelease: false
      draft_release: true
      verify_nix: ${{ !((github.event_name == 'workflow_dispatch' && github.event.inputs.source_only == 'true') || (github.event_name == 'push' && contains(github.event.head_commit.message, '[source-only]'))) }}
      build_platform_artifacts: ${{ !((github.event_name == 'workflow_dispatch' && github.event.inputs.source_only == 'true') || (github.event_name == 'push' && contains(github.event.head_commit.message, '[source-only]'))) }}
    secrets: inherit
