0.3.2 #67
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: CI | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
jobs: | |
build-linux: | |
strategy: | |
matrix: | |
platform: | |
- name: x86_64 | |
target: amd64 | |
runs-on: ubuntu-latest | |
- name: aarch64 | |
target: arm64 | |
runs-on: [self-hosted, linux, ARM64] | |
runs-on: ${{ matrix.platform.runs-on }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: cachix/install-nix-action@v26 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
- run: nix build | |
- name: Upload ${{ matrix.platform.name }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bandsnatch-linux-${{ matrix.platform.name }} | |
path: ./result/bin/bandsnatch | |
build-macos-x86: | |
runs-on: macos-13 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: cachix/install-nix-action@v26 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
- run: nix build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: bandsnatch-macos-x86_64 | |
path: ./result/bin/bandsnatch | |
build-macos-arm: | |
runs-on: macos-14 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: cachix/install-nix-action@v26 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
- run: nix build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: bandsnatch-macos-aarch64 | |
path: ./result/bin/bandsnatch | |
build-windows: | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install toolchain | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable-x86_64-pc-windows-msvc | |
target: x86_64-pc-windows-msvc | |
- name: Build | |
run: cargo build --release --target x86_64-pc-windows-msvc | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: "bandsnatch-windows-x86_64" | |
path: "target/x86_64-pc-windows-msvc/release/bandsnatch.exe" | |
# TODO: clippy lints & rustfmt | |
create-release: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: | |
- build-linux | |
- build-macos-x86 | |
- build-macos-arm | |
- build-windows | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
- name: Rename files | |
run: | | |
mkdir out && cd out | |
declare -a arr=( | |
"windows-x86_64" | |
"macos-x86_64" | |
"macos-aarch64" | |
"linux-x86_64" | |
"linux-aarch64" | |
) | |
for target in "${arr[@]}" | |
do | |
if [[ "$target" == *windows* ]]; then | |
src="../bandsnatch-$target/bandsnatch.exe" | |
filename="bandsnatch-$target.exe" | |
else | |
src="../bandsnatch-$target/bandsnatch" | |
filename="bandsnatch-$target" | |
fi | |
cp $src $filename | |
sha256sum "$filename" >> "checksums.txt" | |
done | |
- name: Create draft release | |
uses: softprops/action-gh-release@v2 | |
with: | |
body: Update the description for the release! | |
draft: true | |
files: ./out/* | |
- name: Update Homebrew tap | |
uses: mislav/bump-homebrew-formula-action@v3 | |
with: | |
formula-name: bandsnatch | |
homebrew-tap: Ovyerus/homebrew-tap | |
env: | |
COMMITTER_TOKEN: ${{ secrets.TAP_COMMITTER_TOKEN }} |