name: Release env: CARGO_DIST_VERSION: 0.28.0 on: push: tags: - "v*.*.*" jobs: dist: permissions: contents: write id-token: write attestations: write runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - name: Install Rust run: | rustup toolchain install stable --profile minimal rustup default stable - name: Install cargo-dist run: | curl -fsSL --proto '=https' --tlsv1.2 \ "https://github.com/axodotdev/cargo-dist/releases/download/v${CARGO_DIST_VERSION}/cargo-dist-installer.sh" \ -o /tmp/cargo-dist-installer.sh CARGO_DIST_NO_MODIFY_PATH=1 sh /tmp/cargo-dist-installer.sh - name: Verify cargo-dist version run: cargo dist --version | grep -F "cargo-dist ${CARGO_DIST_VERSION}" - name: Initialize cargo-dist config run: cargo dist init --yes - name: Build release artifacts run: cargo dist build --target=x86_64-unknown-linux-gnu - name: Publish GitHub release and upload artifacts env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: cargo dist host --steps=upload - name: Collect attestation subjects shell: bash run: | set -euo pipefail subjects_dir="attestation-subjects" rm -rf "${subjects_dir}" mkdir -p "${subjects_dir}" found=0 for artifact_dir in dist target/distrib; do if [[ -d "${artifact_dir}" ]]; then while IFS= read -r -d '' file; do cp "${file}" "${subjects_dir}/" found=1 done < <(find "${artifact_dir}" -maxdepth 1 -type f -print0) fi done if [[ "${found}" -eq 0 ]]; then echo "No release artifact files found in dist/ or target/distrib/." exit 1 fi echo "Attestation subjects:" ls -l "${subjects_dir}" - name: Attest release build provenance uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0 with: subject-path: attestation-subjects/*