Build cargo-sweep #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build cargo-sweep | |
on: | |
# Runs weekly on Sunday at midnight. | |
schedule: | |
- cron: 0 0 * * 0 | |
# Allow running manually. | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
attestations: write | |
jobs: | |
build: | |
name: Build cargo-sweep | |
strategy: | |
# Do not stop if build fails for one OS. | |
fail-fast: false | |
# Run for all available runners. | |
matrix: | |
os: | |
- name: cargo-sweep-linux | |
runs-on: ubuntu-latest | |
exe: cargo-sweep | |
- name: cargo-sweep-windows | |
runs-on: windows-latest | |
exe: cargo-sweep.exe | |
- name: cargo-sweep-macos | |
runs-on: macos-latest | |
exe: cargo-sweep | |
runs-on: ${{ matrix.os.runs-on }} | |
steps: | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Build cargo-sweep | |
# Keep version in sync with `main.js`. | |
# The compiled binary will be saved to `./bin/cargo-sweep`. | |
run: cargo install cargo-sweep --version ^0.7.0 --root . --no-track | |
- name: Attest binary | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-name: ${{ matrix.os.name }} | |
subject-path: bin/${{ matrix.os.exe }} | |
- name: Upload binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os.name }} | |
path: bin/${{ matrix.os.exe }} | |
if-no-files-found: error | |
# Artifact should be retained for 3 weeks. This workflow is run weekly, so even if it | |
# fails once, older versions will still be available. | |
retention-days: 21 |