1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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 }}