Build Spotty for all platforms #173
Workflow file for this run
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 Spotty for all platforms | |
on: | |
push: | |
branches: [spotty] | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
KEYMASTER_CLIENT_ID: ${{ secrets.KEYMASTER_CLIENT_ID }} | |
jobs: | |
macOS: | |
runs-on: macos-13 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Write Build Configuration File | |
uses: DamianReeves/[email protected] | |
with: | |
path: ./src/client_id.txt | |
contents: ${{ env.KEYMASTER_CLIENT_ID }} | |
write-mode: overwrite | |
- name: Install Rust support for ARM64 & prepare environment | |
run: | | |
rustup target add aarch64-apple-darwin | |
mkdir releases | |
- name: Build | |
run: | | |
cargo build --release | |
cargo build --target=aarch64-apple-darwin --release | |
- name: Build fat binary | |
run: | | |
lipo -create \ | |
-arch x86_64 target/release/spotty \ | |
-arch arm64 target/aarch64-apple-darwin/release/spotty \ | |
-output releases/spotty | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: spotty-mac | |
path: releases/ | |
Linux: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Write Build Configuration File | |
uses: DamianReeves/[email protected] | |
with: | |
path: ./src/client_id.txt | |
contents: ${{ env.KEYMASTER_CLIENT_ID }} | |
write-mode: overwrite | |
- name: Prepare build environment | |
run: | | |
rustup target add x86_64-unknown-linux-musl | |
curl -L https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-musl.tar.gz | tar xvz | |
mkdir -p releases/i386-linux | |
mkdir -p releases/aarch64-linux | |
mkdir -p releases/arm-linux | |
- name: Build i686 | |
run: | | |
./cross build --release --target=i686-unknown-linux-musl | |
cp target/i686-unknown-linux-musl/release/spotty releases/i386-linux/spotty | |
- name: Build x86_64 | |
run: | | |
./cross build --release --target=x86_64-unknown-linux-musl | |
cp target/x86_64-unknown-linux-musl/release/spotty releases/i386-linux/spotty-x86_64 | |
- name: Build ARMv8 | |
run: | | |
./cross build --release --target=aarch64-unknown-linux-musl | |
cp target/aarch64-unknown-linux-musl/release/spotty releases/aarch64-linux/spotty | |
- name: Build ARMv7 musl | |
run: | | |
./cross build --release --target=armv7-unknown-linux-musleabihf | |
cp target/armv7-unknown-linux-musleabihf/release/spotty releases/arm-linux/spotty-muslhf | |
- name: Build ARM musl | |
run: | | |
./cross build --release --target=arm-unknown-linux-musleabi | |
cp target/arm-unknown-linux-musleabi/release/spotty releases/arm-linux/spotty | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: spotty-linux | |
path: releases/ | |
windows: | |
runs-on: windows-2019 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Write Build Configuration File | |
uses: DamianReeves/[email protected] | |
with: | |
path: ./src/client_id.txt | |
contents: ${{ env.KEYMASTER_CLIENT_ID }} | |
write-mode: overwrite | |
- name: Build | |
run: cargo build --release | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: spotty.exe | |
path: target/release/spotty.exe |