atfits-rs 1.0.4

Shared low-level cfitsio helpers (pixel I/O, header editing, image creation) for the at*-rs FITS tools
Documentation
name: CD

on:
  workflow_dispatch:
  release:
    types:
      - published

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  FORCE_COLOR: 3
  CARGO_TERM_COLOR: always

jobs:
  publish-crates:
    name: Publish to crates.io
    runs-on: ubuntu-latest
    if: github.event_name == 'release' && github.event.action == 'published'
    steps:
      - uses: actions/checkout@v6

      # `cargo publish` runs a local verification build on this runner with the
      # default (no fitsio-src) feature set, which links the system cfitsio.
      # Install it here so verification succeeds the same way docs.rs/crates.io
      # build the published crate.
      - name: Install cfitsio
        run: sudo apt-get update && sudo apt-get install -y libcfitsio-dev pkg-config

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable

      - name: Install cargo-edit
        uses: taiki-e/install-action@v2
        with:
          tool: cargo-edit

      - name: Pin version from release tag
        shell: bash
        env:
          RELEASE_TAG: ${{ github.event.release.tag_name }}
        run: cargo set-version "${RELEASE_TAG#v}"

      # --allow-dirty: `cargo set-version` leaves the manifest modified vs HEAD.
      # crates.io builds with libcfitsio-dev present, like docs.rs, so the
      # default (no fitsio-src) feature set publishes cleanly.
      - name: Publish crate
        run: cargo publish --allow-dirty --token ${{ secrets.CARGO_REGISTRY_TOKEN }}