name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
env:
CARGO_TERM_COLOR: always
ACC_RSS_LIBS: "/home/runner/work/a121-sys/a121-sys/staticlibs"
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
submodules: true
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: thumbv7em-none-eabihf
- name: Install the Arm toolchain
timeout-minutes: 10
run: |
# Skip rebuilding the man page index, which makes installs slow on the runners.
# A short timeout retries stalled mirror downloads instead of waiting on them.
sudo rm -f /var/lib/man-db/auto-update
sudo apt-get -o Acquire::Retries=5 -o Acquire::http::Timeout=20 update
sudo apt-get -o Acquire::Retries=5 -o Acquire::http::Timeout=20 install -y --no-install-recommends gcc-arm-none-eabi libnewlib-arm-none-eabi
- name: Create lib directory
run: mkdir -p "$ACC_RSS_LIBS"
- name: Generate Cargo.lock
run: cargo generate-lockfile
env:
CC_thumbv7em_none_eabihf: arm-none-eabi-gcc
AR_thumbv7em_none_eabihf: arm-none-eabi-ar
- name: Verify tag version matches Cargo.toml
run: |
CARGO_VERSION=$(cargo pkgid | cut -d# -f2)
TAG_VERSION=${GITHUB_REF#refs/tags/v}
if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then
echo "Version mismatch: Cargo.toml ($CARGO_VERSION) != Tag ($TAG_VERSION)"
exit 1
fi
- name: Build package
run: |
cargo package --no-verify --features="stub_library,distance,presence"
env:
CC_thumbv7em_none_eabihf: arm-none-eabi-gcc
AR_thumbv7em_none_eabihf: arm-none-eabi-ar
- name: Publish to crates.io
run: |
cargo publish --features="stub_library,distance,presence" --token ${CRATES_TOKEN} --allow-dirty
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
CC_thumbv7em_none_eabihf: arm-none-eabi-gcc
AR_thumbv7em_none_eabihf: arm-none-eabi-ar