temporal-agent-rs 0.1.0

Durable AI agent execution on Temporal using AutoAgents traits.
Documentation
name: Release

on:
  push:
    tags: ['v*']

concurrency:
  group: release-${{ github.ref }}
  cancel-in-progress: false

permissions:
  contents: write
  id-token: write

env:
  CARGO_TERM_COLOR: always
  RUSTFLAGS: -D warnings

jobs:
  release:
    name: release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
        with:
          fetch-depth: 0

      - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
        with:
          components: rustfmt, clippy

      - uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}

      - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2

      - name: Verify tag matches Cargo.toml version
        run: |
          set -euo pipefail
          tag="${GITHUB_REF_NAME#v}"
          crate=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
          if [ "$tag" != "$crate" ]; then
            echo "::error::Tag ${GITHUB_REF_NAME} does not match Cargo.toml version (${crate})"
            exit 1
          fi
          echo "Tag ${GITHUB_REF_NAME} matches Cargo.toml version ${crate}"

      - name: cargo fmt --all --check
        run: cargo fmt --all --check

      - name: cargo clippy
        run: cargo clippy --locked --all-targets --all-features -- -D warnings

      - name: cargo test --lib
        run: cargo test --locked --lib --all-features

      - name: cargo doc
        run: cargo doc --locked --no-deps --all-features
        env:
          RUSTDOCFLAGS: -D warnings

      - name: cargo publish --dry-run
        run: cargo publish --locked --dry-run

      - name: cargo publish
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: cargo publish --locked

      - name: Create GitHub Release
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          set -euo pipefail
          current="${GITHUB_REF_NAME}"
          args=("${current}" "--title" "${current}" "--generate-notes")

          # Find the most recent non-prerelease tag less than the current one.
          # SemVer prereleases contain '-', e.g. v0.1.0-rc.1.
          prev=$(git tag --list 'v*' --sort=-v:refname \
            | grep -v -- '-' \
            | awk -v cur="${current}" '$0 != cur { print; exit }' \
            || true)
          if [ -n "${prev}" ]; then
            echo "Previous stable tag: ${prev}"
            args+=("--notes-start-tag" "${prev}")
          else
            echo "No previous stable tag — auto-generation will use full history."
          fi

          if [[ "${current}" == *-* ]]; then
            args+=("--prerelease")
          fi

          gh release create "${args[@]}"