name: Build and Release
on:
workflow_dispatch:
env:
VERSION: 1.0.7
jobs:
build_and_package:
name: Build & Package
runs-on: ${{ matrix.platform }}
permissions: write-all
strategy:
fail-fast: false
matrix:
include:
- platform: macos-latest
artifact_paths: target/release/tooka*_aarch64.dmg
build_args: ""
cross: false
- platform: macos-15-intel
artifact_paths: target/release/tooka*_x64.dmg
build_args: ""
cross: false
- platform: ubuntu-latest
artifact_paths: |
target/x86_64-unknown-linux-musl/release/tooka*_amd64.deb
target/x86_64-unknown-linux-musl/release/tooka*_x86_64.AppImage
target/x86_64-unknown-linux-musl/generate-rpm/tooka*.rpm
build_args: "--target=x86_64-unknown-linux-musl"
cross: true
apt: musl-tools
sysroot: ""
pkg_arch: musl
rust_target: x86_64-unknown-linux-musl
- platform: windows-latest
artifact_paths: |
target/release/tooka*_x64_en-US.msi
target/release/tooka*_x64-setup.exe
build_args: ""
cross: false
- platform: ubuntu-latest
artifact_paths: |
target/aarch64-unknown-linux-gnu/release/tooka*.deb
target/aarch64-unknown-linux-gnu/generate-rpm/tooka*.rpm
build_args: "--target=aarch64-unknown-linux-gnu"
cross: true
apt: gcc-aarch64-linux-gnu
sysroot: /usr/aarch64-linux-gnu/
pkg_arch: arm64
rust_target: aarch64-unknown-linux-gnu
- platform: ubuntu-latest
artifact_paths: |
target/armv7-unknown-linux-gnueabihf/release/tooka*.deb
target/armv7-unknown-linux-gnueabihf/generate-rpm/tooka*.rpm
build_args: "--target=armv7-unknown-linux-gnueabihf"
cross: true
apt: gcc-arm-linux-gnueabihf
sysroot: /usr/arm-linux-gnueabihf/
pkg_arch: armhf
rust_target: armv7-unknown-linux-gnueabihf
steps:
- uses: actions/checkout@v6
- name: Install cross dependencies (cross only)
if: matrix.cross
run: |
sudo apt-get update
sudo apt-get install -y pkg-config build-essential curl ${{ matrix.apt }}
- uses: dtolnay/rust-toolchain@stable
- uses: swatinem/rust-cache@v2
- name: Install Rust target (cross only)
if: matrix.cross
run: rustup target add ${{ matrix.rust_target }}
- name: Set PKG_CONFIG_SYSROOT_DIR (cross only)
if: matrix.cross && matrix.sysroot != ''
run: echo "PKG_CONFIG_SYSROOT_DIR=${{ matrix.sysroot }}" >> $GITHUB_ENV
- name: Install app dependencies
run: cargo install cargo-packager cargo-generate-rpm --locked
- name: Build the application
run: cargo build --release ${{ matrix.build_args }}
- name: Package Binary
shell: bash
run: |
if [ "${{ matrix.cross }}" = "true" ] && [ "${{ matrix.sysroot }}" != "" ]; then
cargo packager --target=${{ matrix.rust_target }} --formats=deb --release --verbose
elif [ "${{ matrix.cross }}" = "true" ] && [ -z "${{ matrix.sysroot }}" ]; then
cargo packager --target=${{ matrix.rust_target }} --release --verbose
else
cargo packager --release --verbose
fi
- name: Package RPM
if: matrix.platform == 'ubuntu-latest'
run: |
if [ "${{ matrix.cross }}" = "true" ]; then
cargo generate-rpm --target=${{ matrix.rust_target }}
else
cargo generate-rpm
fi
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.platform }}${{ matrix.cross && format('-{0}', matrix.pkg_arch) || '' }}-release-artifacts
path: ${{ matrix.artifact_paths }}
upload_to_release:
name: Upload to GitHub Release
runs-on: ubuntu-latest
permissions: write-all
needs: [build_and_package]
steps:
- uses: actions/download-artifact@v8
with:
path: artifacts
merge-multiple: true
- name: Create attestation for all builds
uses: actions/attest@v4
with:
subject-path: artifacts/**/tooka*
- name: Release to GitHub
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
tag_name: Tooka v${{ env.VERSION }}
files: artifacts/**/tooka*