# This workflow triggers the release process after code check is completed
#
name: Release
run-name: ${{ github.event.workflow_run.head_commit.message }} [${{ github.event.workflow_run.id }}]

# Controls when the action will run.
on:
  workflow_run:
    workflows: [Checks]
    types: [completed]
    branches: [main, next, beta, alpha]

concurrency:
  # group: ${{ github.workflow }}_${{ github.head_ref || github.ref || github.run_id }}
  # Use the name of the triggering workflow run as the concurrency group to avoid conccurency issues
  group: ${{ github.workflow }}_${{ github.event.workflow_run.head_branch || github.ref_name || github.run_id }}
  cancel-in-progress: true

# Declare default permissions as read only.
permissions:
  contents: read

jobs:
  semantic-release:
    name: '▶️ actions'
    uses: ./.github/workflows/semantic-release.yml
    permissions:
      contents: write
      issues: write
      pull-requests: write
      id-token: write
    secrets:
      GH_TOKEN: ${{ secrets.GH_TOKEN }} # Token with repo write permission & admin rights to push to protected branches
