|
| 1 | +name: sbuild-cache release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - "v*.*.*-cache" |
| 8 | + paths: |
| 9 | + - "sbuild-cache/**" |
| 10 | + - "Cargo.toml" |
| 11 | + - "Cargo.lock" |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: write |
| 15 | + |
| 16 | +jobs: |
| 17 | + publish-binaries: |
| 18 | + name: Publish binaries |
| 19 | + runs-on: ubuntu-latest |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + build: |
| 24 | + - { |
| 25 | + NAME: x86_64-linux, |
| 26 | + TARGET: x86_64-unknown-linux-musl, |
| 27 | + } |
| 28 | + - { |
| 29 | + NAME: aarch64-linux, |
| 30 | + TARGET: aarch64-unknown-linux-musl, |
| 31 | + } |
| 32 | + - { |
| 33 | + NAME: riscv64-linux, |
| 34 | + TARGET: riscv64gc-unknown-linux-musl |
| 35 | + } |
| 36 | + steps: |
| 37 | + - name: Checkout |
| 38 | + uses: actions/checkout@v4 |
| 39 | + |
| 40 | + - name: Set the release version |
| 41 | + shell: bash |
| 42 | + run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV |
| 43 | + |
| 44 | + - name: Install dependencies |
| 45 | + shell: bash |
| 46 | + run: | |
| 47 | + sudo apt-get update |
| 48 | + sudo apt-get install -y --no-install-recommends \ |
| 49 | + --allow-unauthenticated musl-tools b3sum |
| 50 | +
|
| 51 | + - name: Install Rust toolchain |
| 52 | + uses: dtolnay/rust-toolchain@nightly |
| 53 | + with: |
| 54 | + targets: ${{ matrix.build.TARGET }} |
| 55 | + |
| 56 | + - name: Install cross-compilation tools |
| 57 | + uses: taiki-e/setup-cross-toolchain-action@v1 |
| 58 | + with: |
| 59 | + target: ${{ matrix.build.TARGET }} |
| 60 | + |
| 61 | + - name: Build |
| 62 | + run: RUSTFLAGS="-C target-feature=+crt-static" cargo build --bin sbuild-cache --release --locked --target ${{ matrix.build.TARGET }} |
| 63 | + |
| 64 | + - name: Prepare release assets |
| 65 | + shell: bash |
| 66 | + run: | |
| 67 | + mkdir -p release |
| 68 | + cp {LICENSE,README.md} release/ |
| 69 | + cp "target/${{ matrix.build.TARGET }}/release/sbuild-cache" release/ |
| 70 | +
|
| 71 | + - name: Create release artifacts |
| 72 | + shell: bash |
| 73 | + run: | |
| 74 | + cp release/sbuild-cache sbuild-cache-${{ matrix.build.NAME }} |
| 75 | + b3sum sbuild-cache-${{ matrix.build.NAME }} \ |
| 76 | + > sbuild-cache-${{ matrix.build.NAME }}.b3sum |
| 77 | + tar -czvf sbuild-cache-${{ matrix.build.NAME }}.tar.gz \ |
| 78 | + release/ |
| 79 | + b3sum sbuild-cache-${{ matrix.build.NAME }}.tar.gz \ |
| 80 | + > sbuild-cache-${{ matrix.build.NAME }}.tar.gz.b3sum |
| 81 | +
|
| 82 | + - name: Publish to GitHub (versioned) |
| 83 | + uses: svenstaro/upload-release-action@v2 |
| 84 | + with: |
| 85 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 86 | + file: sbuild-cache-${{ matrix.build.NAME }}* |
| 87 | + file_glob: true |
| 88 | + overwrite: true |
| 89 | + tag: ${{ github.ref }} |
| 90 | + release_name: "sbuild-cache v${{ env.RELEASE_VERSION }}" |
| 91 | + |
| 92 | + - name: Publish to GitHub (latest) |
| 93 | + uses: svenstaro/upload-release-action@v2 |
| 94 | + with: |
| 95 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 96 | + file: sbuild-cache-${{ matrix.build.NAME }}* |
| 97 | + file_glob: true |
| 98 | + overwrite: true |
| 99 | + tag: latest-cache |
| 100 | + release_name: "sbuild-cache (latest)" |
| 101 | + prerelease: true |
0 commit comments