classicube-sys 6.0.4+ClassiCube.1.3.8

Rust C bindings for ClassiCube.
Documentation
name: release

on:
  push:
    branches: [main, master, alpha, beta]
  workflow_dispatch:

permissions: {} # each job declares its own

jobs:
  build:
    uses: ./.github/workflows/build.yml
    if: "${{ ! startsWith(github.event.head_commit.message, 'chore(release): ') }}"
    permissions:
      contents: read # for checkout in called workflow

  get-version-metadata:
    runs-on: ubuntu-24.04
    needs: build
    if: "${{ ! startsWith(github.event.head_commit.message, 'chore(release): ') }}"
    permissions:
      contents: read
    outputs:
      version-metadata: ${{ steps.get-version-metadata.outputs.version-metadata }}
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          fetch-depth: 0
          fetch-tags: true
          submodules: recursive
      - id: get-version-metadata
        run: |
          classicube_version="$(git -C ./ClassiCube/ describe --exact-match --tags HEAD)"
          test -z "$classicube_version" && echo "classicube_version is empty" && exit 1
          version_metadata="ClassiCube $classicube_version"
          echo "version-metadata=$version_metadata" | tee -a "$GITHUB_OUTPUT"

  release:
    uses: SpiralP/github-reusable-workflows/.github/workflows/release.yml@78cca1708ee40ff0f5cab7b971204653ddefcca0 # main
    needs: get-version-metadata
    if: "${{ needs.get-version-metadata.outputs.version-metadata }}"
    permissions: {} # none, since we use a custom app
    concurrency:
      group: release-${{ github.ref }}
      cancel-in-progress: false # do not cancel in-progress jobs
    with:
      cargo-publish: true
      environment-name: release
      replace-files: |
        Cargo.lock
        Cargo.toml
      package-name: classicube-sys
      version-metadata: ${{ needs.get-version-metadata.outputs.version-metadata }}
      # Dispatch build.yml on the just-pushed release tag during the publish
      # phase (before the GH release is created), so windows x86_64 uploads a
      # `github-pages` artifact built against the bumped Cargo.toml. The
      # deploy-docs job below pipes it across into this run for Pages deploy.
      # Cross-platform builds in the dispatched run also serve as a sanity
      # check; any failure auto-deletes the tag from origin.
      build-workflow: build.yml
    secrets:
      app-client-id: ${{ secrets.APP_CLIENT_ID }}
      app-private-key: ${{ secrets.APP_PRIVATE_KEY }}
      cargo-registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}

  deploy-docs:
    name: Deploy docs to Pages
    needs: release
    if: ${{ needs.release.outputs.tag && !contains(needs.release.outputs.tag, '-') }}
    runs-on: ubuntu-24.04
    permissions:
      contents: read
      actions: read # cross-run artifact download
      pages: write
      id-token: write
    environment:
      name: github-pages
      url: ${{ steps.deploy.outputs.page-url }}
    concurrency:
      group: pages
      cancel-in-progress: false
    steps:
      - id: deploy
        uses: SpiralP/github-reusable-workflows/.github/actions/deploy-pages-from-run@78cca1708ee40ff0f5cab7b971204653ddefcca0 # main
        with:
          run-id: ${{ needs.release.outputs.dispatched-run-id }}