Skip to content

Fix release versioning in built files #17

Fix release versioning in built files

Fix release versioning in built files #17

Workflow file for this run

name: Release Binaries
on:
workflow_dispatch:
push:
tags:
- "v*"
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
build:
name: Build ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: linux-x64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- name: linux-x64-musl
os: ubuntu-latest
target: x86_64-unknown-linux-musl
- name: linux-arm64
os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
- name: linux-armv7
os: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
- name: macos-arm64
os: macos-14
target: aarch64-apple-darwin
- name: windows-x64
os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Add Rust target
run: rustup target add ${{ matrix.target }}
- name: Install ARMv7 linker
if: matrix.target == 'armv7-unknown-linux-gnueabihf'
run: |
sudo apt-get update
sudo apt-get install -y gcc-arm-linux-gnueabihf
- name: Install musl toolchain
if: matrix.target == 'x86_64-unknown-linux-musl'
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
- name: Build release binary (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
set -euo pipefail
if [ "${{ matrix.target }}" = "armv7-unknown-linux-gnueabihf" ]; then
export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc
elif [ "${{ matrix.target }}" = "x86_64-unknown-linux-musl" ]; then
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc
fi
cargo build --release --target "${{ matrix.target }}" -p spuc-cli --bin spuc
- name: Build release binary (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: cargo build --release --target ${{ matrix.target }} -p spuc-cli --bin spuc
- name: Package (Linux/macOS)
if: runner.os != 'Windows'
id: package_unix
shell: bash
run: |
set -euo pipefail
VERSION="$(awk -F'\"' '/^version[[:space:]]*=/{print $2; exit}' Cargo.toml)"
OUT="spuc-v${VERSION}-${{ matrix.target }}"
mkdir -p "dist/${OUT}"
cp "target/${{ matrix.target }}/release/spuc" "dist/${OUT}/"
cp README.md LICENSE.md "dist/${OUT}/"
tar -C dist -czf "dist/${OUT}.tar.gz" "${OUT}"
echo "asset=dist/${OUT}.tar.gz" >> "${GITHUB_OUTPUT}"
- name: Package (Windows)
if: runner.os == 'Windows'
id: package_windows
shell: pwsh
run: |
$versionLine = Select-String -Path Cargo.toml -Pattern '^version\s*=\s*"(.*)"' | Select-Object -First 1
$version = $versionLine.Matches[0].Groups[1].Value
$out = "spuc-v$version-${{ matrix.target }}"
New-Item -ItemType Directory -Force -Path "dist/$out" | Out-Null
Copy-Item "target/${{ matrix.target }}/release/spuc.exe" "dist/$out/"
Copy-Item "README.md","LICENSE.md" "dist/$out/"
Compress-Archive -Path "dist/$out/*" -DestinationPath "dist/$out.zip" -Force
"asset=dist/$out.zip" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Upload artifact (Linux/macOS)
if: runner.os != 'Windows'
uses: actions/upload-artifact@v4
with:
name: spuc-${{ matrix.name }}
path: ${{ steps.package_unix.outputs.asset }}
- name: Upload artifact (Windows)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: spuc-${{ matrix.name }}
path: ${{ steps.package_windows.outputs.asset }}
build-tauri:
name: Tauri desktop ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: linux-x64
os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
- name: macos-arm64
os: macos-14
target: aarch64-apple-darwin
- name: windows-x64
os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Add Rust target
run: rustup target add ${{ matrix.target }}
- name: Install Linux system dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libjavascriptcoregtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf \
libssl-dev \
pkg-config \
build-essential \
curl \
wget \
file \
libxdo-dev \
libgtk-3-dev
- name: Build desktop binary (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
set -euo pipefail
cargo build --release --target "${{ matrix.target }}" -p spuc-cli --bin spuc
cargo build --release --target "${{ matrix.target }}" -p spuc-gui
- name: Build desktop binary (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cargo build --release --target ${{ matrix.target }} -p spuc-cli --bin spuc
cargo build --release --target ${{ matrix.target }} -p spuc-gui
- name: Upload desktop artifacts (Linux / macOS)
if: runner.os != 'Windows'
uses: actions/upload-artifact@v4
with:
name: tauri-${{ matrix.name }}
path: |
target/${{ matrix.target }}/release/spuc-gui
target/${{ matrix.target }}/release/spuc
- name: Upload desktop artifacts (Windows)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: tauri-${{ matrix.name }}
path: |
target/${{ matrix.target }}/release/spuc-gui.exe
target/${{ matrix.target }}/release/spuc.exe
publish:
name: Publish GitHub Release
needs: [build, build-tauri]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Publish release assets
uses: softprops/action-gh-release@v2
with:
files: dist/**/*