hydrolysis 0.3.1

GPU-required self-drawn backend for WaterUI
name: Release

on:
  # crates.io trusted publishing rejects OIDC tokens minted under
  # `workflow_run`, so publishing runs on the `main` push itself — which
  # can only come from a merged pull request (the dev -> main release PR)
  # whose required checks already passed on the same tree. `release-pr`
  # still waits for CI via `workflow_run`.
  push:
    branches: [main]
  workflow_run:
    workflows: ["CI"]
    branches: [main]
    types: [completed]

permissions:
  contents: write
  pull-requests: write
  id-token: write

jobs:
  release:
    if: github.event_name == 'push'
    concurrency:
      group: release-${{ github.ref_name }}
      cancel-in-progress: false
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: main
          fetch-depth: 0
      - uses: dtolnay/rust-toolchain@stable
      - name: Install Linux dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y libfontconfig1-dev libva-dev libpipewire-0.3-dev libegl-dev libgbm-dev libwayland-dev libxkbcommon-dev libvulkan-dev
      # Mint a short-lived crates.io token from the GitHub OIDC identity
      # instead of a stored CARGO_REGISTRY_TOKEN (trusted publishing is
      # configured per crate on crates.io).
      - uses: rust-lang/crates-io-auth-action@v1
        id: crates-io-auth
      - uses: MarcoIeni/release-plz-action@v0.5
        with:
          command: release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}

  release-pr:
    if: github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: main
          fetch-depth: 0
      - uses: dtolnay/rust-toolchain@stable
      - name: Install Linux dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y libfontconfig1-dev libva-dev libpipewire-0.3-dev libegl-dev libgbm-dev libwayland-dev libxkbcommon-dev libvulkan-dev
      - uses: MarcoIeni/release-plz-action@v0.5
        with:
          command: release-pr
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}