name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
id-token: write
attestations: write
env:
CARGO_TERM_COLOR: always
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Check that the tag matches the Cargo.toml version
run: |
TAG="${GITHUB_REF_NAME#v}"
VER=$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2)
if [ "$TAG" != "$VER" ]; then
echo "tag ${GITHUB_REF_NAME} does not match Cargo.toml version ${VER}" >&2
exit 1
fi
- name: Enable KVM for the runner user
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
| sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Install QEMU and ISO tooling
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq qemu-system-x86 qemu-utils genisoimage
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Cache Debian cloud base image
uses: actions/cache@v4
with:
path: ~/.cache/timberfs-vm-tests
key: debian-13-genericcloud-amd64
- uses: taiki-e/install-action@v2
with:
tool: cargo-deb,cargo-zigbuild
- name: Install zig (cargo-zigbuild's cross linker)
run: |
curl -fL --retry 3 \
https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz \
| tar -xJ -C "$RUNNER_TEMP"
echo "$RUNNER_TEMP/zig-linux-x86_64-0.13.0" >> "$GITHUB_PATH"
- name: Build the .deb
run: |
cargo zigbuild --release --target x86_64-unknown-linux-gnu.2.31
cargo deb --variant compat --no-build --target x86_64-unknown-linux-gnu
- name: Test the exact release artifact in a VM
run: tests/vm/run-vm-test.sh target/x86_64-unknown-linux-gnu/debian/timberfs_*_amd64.deb
- name: Stage release assets
run: |
mkdir -p "$RUNNER_TEMP/dist"
cp target/x86_64-unknown-linux-gnu/debian/timberfs_*_amd64.deb "$RUNNER_TEMP/dist/"
cp target/x86_64-unknown-linux-gnu/debian/timberfs_*_amd64.deb "$RUNNER_TEMP/dist/timberfs_amd64.deb"
- name: Attest build provenance
uses: actions/attest-build-provenance@v2
with:
subject-path: ${{ runner.temp }}/dist/*
- name: Create the GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: gh release create "$GITHUB_REF_NAME" "$RUNNER_TEMP"/dist/* --generate-notes --verify-tag
- name: Get a crates.io token via Trusted Publishing (OIDC)
id: crates_auth
continue-on-error: true
uses: rust-lang/crates-io-auth-action@v1
- name: Publish to crates.io (skipped when Trusted Publishing is not configured)
if: steps.crates_auth.outcome == 'success'
env:
CARGO_REGISTRY_TOKEN: ${{ steps.crates_auth.outputs.token }}
run: cargo publish
apt-repo:
needs: release
uses: ./.github/workflows/apt-repo.yml
permissions:
contents: read
pages: write
id-token: write
secrets: inherit