Skip to content

Simplify deps workflow: separate x64 and arm64 jobs (no matrix filter) #8

Simplify deps workflow: separate x64 and arm64 jobs (no matrix filter)

Simplify deps workflow: separate x64 and arm64 jobs (no matrix filter) #8

Workflow file for this run

name: Build Linux

Check failure on line 1 in .github/workflows/build-linux.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build-linux.yml

Invalid workflow file

(Line: 42, Col: 9): Unrecognized named-value: 'matrix'. Located at position 41 within expression: inputs.arch == 'both' || inputs.arch == matrix.arch
on:
workflow_dispatch:
inputs:
version:
description: 'Version number (e.g., 0.9.0)'
required: true
type: string
deps_tag:
description: 'Deps release tag (e.g., deps-v1.3.0)'
required: true
type: string
arch:
description: 'Architecture'
required: false
type: choice
options:
- x64
- arm64
- both
default: x64
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-22.04
arch: x64
flutter_arch: x64
rust_target: x86_64-unknown-linux-gnu
- os: ubuntu-22.04-arm
arch: arm64
flutter_arch: arm64
rust_target: aarch64-unknown-linux-gnu
fail-fast: false
runs-on: ${{ matrix.os }}
# Only run the job if it matches the requested arch (or both)
if: ${{ inputs.arch == 'both' || inputs.arch == matrix.arch }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake git ninja-build pkg-config \
libgtk-3-dev liblzma-dev libstdc++-12-dev
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust_target }}
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
worker/target/
key: ${{ runner.os }}-${{ matrix.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.arch }}-cargo-
- name: Download Linux dependencies
run: |
DEPS_VERSION="${{ inputs.deps_tag }}"
DEPS_VERSION="${DEPS_VERSION#deps-v}"
mkdir -p deps/linux-${{ matrix.arch }}
DEPS_URL="https://github.com/${{ github.repository }}/releases/download/${{ inputs.deps_tag }}/VapourBox-deps-${DEPS_VERSION}-linux-${{ matrix.arch }}.zip"
echo "Downloading deps from: $DEPS_URL"
curl -L -o deps.zip "$DEPS_URL"
unzip -o deps.zip -d deps/linux-${{ matrix.arch }}
rm -f deps.zip
echo "Dependencies extracted:"
ls -la deps/
- name: Update version numbers
run: |
VERSION="${{ inputs.version }}"
DEPS_TAG="${{ inputs.deps_tag }}"
DEPS_VERSION="${DEPS_TAG#deps-v}"
# Update pubspec.yaml
sed -i "s/^version: .*/version: ${VERSION}+1/" app/pubspec.yaml
# Update deps-version.json
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"${DEPS_VERSION}\"/" app/assets/deps-version.json
sed -i "s/\"releaseTag\": \"[^\"]*\"/\"releaseTag\": \"${DEPS_TAG}\"/" app/assets/deps-version.json
# Update Cargo.toml
sed -i "s/^version = \".*\"/version = \"${VERSION}\"/" worker/Cargo.toml
- name: Build Rust worker
run: |
cd worker
cargo build --release --target ${{ matrix.rust_target }}
# Copy to default release location for package script
mkdir -p target/release
cp target/${{ matrix.rust_target }}/release/vapourbox-worker target/release/ || true
- name: Build Flutter app
run: |
cd app
flutter pub get
dart run build_runner build --delete-conflicting-outputs
flutter build linux --release
- name: Package release
run: |
./Scripts/package-linux.sh --version "${{ inputs.version }}" --arch ${{ matrix.arch }} --skip-build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: VapourBox-${{ inputs.version }}-linux-${{ matrix.arch }}
path: dist/VapourBox-${{ inputs.version }}-linux-${{ matrix.arch }}.tar.gz