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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Release macula-rust-ffi to crates.io
# Distinct tag prefix from release-core.yml's plain "v*" (macula-rust and
# macula-rust-ffi are independently versioned -- see CHANGELOG.md's own
# note on this -- so one tag namespace can't unambiguously say which
# package's version it's naming).
on:
push:
tags:
jobs:
publish:
name: publish to crates.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF_NAME#ffi-v}" >> "$GITHUB_OUTPUT"
- name: Validate version matches macula-rust-ffi/Cargo.toml
run: |
PACKAGE_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' macula-rust-ffi/Cargo.toml | head -1)
if [ "$PACKAGE_VERSION" != "${{ steps.version.outputs.VERSION }}" ]; then
echo "::error::Tag version (${{ steps.version.outputs.VERSION }}) doesn't match macula-rust-ffi/Cargo.toml version ($PACKAGE_VERSION)"
exit 1
fi
# Same reasoning as release-core.yml: rebuild and retest from scratch
# (a tag push is a separate event from the branch push ci.yml
# validated), against the committed Cargo.lock.
# The integration tests dial macula-go's in-process stations
# (tests/teststation), built to target/teststation first.
- uses: actions/setup-go@v5
with:
go-version-file: tests/teststation/go.mod
cache-dependency-path: tests/teststation/go.sum
- run: ./scripts/build-teststation.sh
- run: cargo build --workspace --all-targets --locked
- run: cargo test --workspace --all-features --locked
- run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
- run: cargo fmt --all -- --check
# Dry-run needs no registry auth -- it only verifies metadata,
# compresses the package, and checks the result, never uploads.
# This is also the step that proves macula-rust-ffi's `macula-rust
# = { path = "..", version = "0.6" }` dependency actually resolves
# against the REAL published macula-rust on crates.io, not just the
# local workspace path -- `cargo publish` downloads and rebuilds
# against the registry version during verification, confirmed
# locally before this workflow existed.
- name: Dry-run publish (catches packaging issues before the real one)
run: cargo publish --dry-run -p macula-rust-ffi
# Same CRATES_IO_TOKEN as release-core.yml (one secret, both
# workflows) -- see that workflow's own comment for why this is a
# static token rather than OIDC Trusted Publishing, and the
# migration path once both crates exist on crates.io.
- name: Publish to crates.io
run: cargo publish -p macula-rust-ffi
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}