From 31cdd4932bb871e284d9e121c1e92071a3276c87 Mon Sep 17 00:00:00 2001 From: cloudwithax Date: Wed, 18 Feb 2026 21:20:49 -0500 Subject: [PATCH] feat: update desktop packaging workflow for self-hosted runners and improve artifact handling --- .gitea/workflows/desktop-packaging.yml | 88 +++++++++++++++++++++----- README.md | 30 +++++++-- 2 files changed, 94 insertions(+), 24 deletions(-) diff --git a/.gitea/workflows/desktop-packaging.yml b/.gitea/workflows/desktop-packaging.yml index 9a34f3b..54cd3f5 100644 --- a/.gitea/workflows/desktop-packaging.yml +++ b/.gitea/workflows/desktop-packaging.yml @@ -6,27 +6,36 @@ on: tags: - "v*" pull_request: + paths: + - "app/**" + - "app/.gitea/workflows/**" jobs: bundle: name: Bundle (${{ matrix.name }}) - runs-on: ${{ matrix.os }} + runs-on: ${{ matrix.runner_labels }} + defaults: + run: + working-directory: app strategy: fail-fast: false matrix: include: - name: Linux - os: ubuntu-22.04 + runner_labels: [self-hosted, linux, x64] package_script: package:linux artifact_name: dusk-linux-bundles + artifact_file: dusk-linux-bundles.tar.gz - name: macOS - os: macos-latest + runner_labels: [self-hosted, macos] package_script: package:macos artifact_name: dusk-macos-bundles + artifact_file: dusk-macos-bundles.tar.gz - name: Windows - os: windows-latest + runner_labels: [self-hosted, windows, x64] package_script: package:windows artifact_name: dusk-windows-bundles + artifact_file: dusk-windows-bundles.zip steps: - name: Checkout @@ -43,17 +52,36 @@ jobs: - name: Install Linux system dependencies if: runner.os == 'Linux' run: | - sudo apt-get update - sudo apt-get install -y \ - libwebkit2gtk-4.1-dev \ - build-essential \ - curl \ - wget \ - file \ - libxdo-dev \ - libssl-dev \ - libayatana-appindicator3-dev \ - librsvg2-dev + set -euo pipefail + if command -v apt-get >/dev/null 2>&1; then + if command -v sudo >/dev/null 2>&1; then + sudo apt-get update + sudo apt-get install -y \ + libwebkit2gtk-4.1-dev \ + build-essential \ + curl \ + wget \ + file \ + libxdo-dev \ + libssl-dev \ + libayatana-appindicator3-dev \ + librsvg2-dev + else + apt-get update + apt-get install -y \ + libwebkit2gtk-4.1-dev \ + build-essential \ + curl \ + wget \ + file \ + libxdo-dev \ + libssl-dev \ + libayatana-appindicator3-dev \ + librsvg2-dev + fi + else + echo "apt-get not available; assuming Linux runner dependencies are preinstalled" + fi - name: Install frontend dependencies run: bun install --frozen-lockfile @@ -61,9 +89,35 @@ jobs: - name: Build Tauri bundles run: bun run ${{ matrix.package_script }} - - name: Upload bundle artifacts + - name: Prepare artifact directory + run: mkdir -p ../ci-artifacts + + - name: Create artifact archive (Linux/macOS) + if: runner.os != 'Windows' + run: | + set -euo pipefail + test -d src-tauri/target/release/bundle + tar -C src-tauri/target/release -czf ../ci-artifacts/${{ matrix.artifact_file }} bundle + + - name: Create artifact archive (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: | + if (!(Test-Path "src-tauri/target/release/bundle")) { + throw "Bundle output directory not found: src-tauri/target/release/bundle" + } + Compress-Archive -Path "src-tauri/target/release/bundle/*" -DestinationPath "../ci-artifacts/${{ matrix.artifact_file }}" -Force + + - name: Upload bundle artifact (Gitea-compatible, best effort) + continue-on-error: true uses: actions/upload-artifact@v4 with: name: ${{ matrix.artifact_name }} if-no-files-found: error - path: src-tauri/target/release/bundle/** + path: ci-artifacts/${{ matrix.artifact_file }} + + - name: Print fallback artifact location on runner + if: always() + run: | + echo "fallback artifacts directory on runner: ${GITHUB_WORKSPACE}/ci-artifacts" + ls -lah ../ci-artifacts diff --git a/README.md b/README.md index 797b9ae..1bd1f2e 100644 --- a/README.md +++ b/README.md @@ -295,19 +295,35 @@ common artifact types by platform: cross-platform packaging is automated in: ```text -app/.github/workflows/desktop-packaging.yml +app/.gitea/workflows/desktop-packaging.yml ``` workflow behavior: -- runs a matrix build on `ubuntu-22.04`, `macos-latest`, and `windows-latest` +- runs a matrix build on **self-hosted gitea runners** for linux, macos, and windows +- uses runner label sets: + - linux: `self-hosted`, `linux`, `x64` + - macos: `self-hosted`, `macos` + - windows: `self-hosted`, `windows`, `x64` - installs bun + rust, then runs platform-specific packaging scripts from `app/package.json` -- uploads generated bundles from `app/src-tauri/target/release/bundle/**` as artifacts: - - `dusk-linux-bundles` - - `dusk-macos-bundles` - - `dusk-windows-bundles` +- archives bundles from `app/src-tauri/target/release/bundle/` into: + - `ci-artifacts/dusk-linux-bundles.tar.gz` + - `ci-artifacts/dusk-macos-bundles.tar.gz` + - `ci-artifacts/dusk-windows-bundles.zip` +- attempts artifact upload with `actions/upload-artifact` (best effort) +- always keeps a fallback copy in runner workspace at `ci-artifacts/` (printed in logs), so artifacts can still be collected when artifact-service compatibility differs across gitea setups -the workflow triggers on manual dispatch, version tags (`v*`), and pull requests that touch the app or packaging workflow. +workflow triggers: + +- manual dispatch (`workflow_dispatch`) +- version tag pushes matching `v*` +- pull requests touching `app/**` (including packaging files) + +runner assumptions: + +- runners are provisioned and registered in gitea with the labels listed above +- linux runners either provide tauri system deps already, or support `apt-get` installation during the workflow +- macos/windows signing and notarization are not configured in this workflow; output installers are unsigned unless runner-side signing is added ## contributing