xisf-header 0.4.3

Read and write XISF image-file headers: extract FITS keywords and CRUD the XISF header container. Header-only (never touches pixel data).
Documentation
name: Release

# release-please maintains a release PR from conventional commits on main,
# authenticating as the sjorsr-release-bot GitHub App so its PRs trigger CI.
# Merging that PR creates the GitHub release + tag, which triggers the publish
# job below. Publishing authenticates via crates.io Trusted Publishing (OIDC);
# there is no long-lived API token anywhere.

on:
  push:
    branches: [main]

permissions: {}

jobs:
  release-please:
    name: Release PR / tag
    runs-on: ubuntu-latest
    outputs:
      release_created: ${{ steps.release.outputs.release_created }}
    steps:
      - uses: actions/create-github-app-token@v2
        id: app-token
        with:
          app-id: ${{ vars.RELEASE_APP_CLIENT_ID || secrets.RELEASE_APP_CLIENT_ID }}
          private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
      - uses: googleapis/release-please-action@v4
        id: release
        with:
          token: ${{ steps.app-token.outputs.token }}
          config-file: release-please-config.json
          manifest-file: .release-please-manifest.json

  publish:
    name: Publish to crates.io
    needs: release-please
    if: needs.release-please.outputs.release_created == 'true'
    runs-on: ubuntu-latest
    environment: release
    permissions:
      id-token: write # OIDC token exchange for Trusted Publishing
      contents: read
    steps:
      - uses: actions/checkout@v4
      # Keeps re-runs and bootstrap releases green: publishing is skipped when
      # this version is already on crates.io.
      - name: Check whether this version is already published
        id: check
        run: |
          version="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)"
          echo "version=${version}"
          if curl -fsS -H "user-agent: xisf-header release workflow (github.com/nightwatch-astro/xisf-header)" \
            "https://crates.io/api/v1/crates/xisf-header/${version}" > /dev/null; then
            echo "published=true" >> "$GITHUB_OUTPUT"
          else
            echo "published=false" >> "$GITHUB_OUTPUT"
          fi
      - uses: dtolnay/rust-toolchain@stable
        if: steps.check.outputs.published == 'false'
      - uses: rust-lang/crates-io-auth-action@v1
        id: auth
        if: steps.check.outputs.published == 'false'
      - run: cargo publish
        if: steps.check.outputs.published == 'false'
        env:
          CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}