goose/.github/workflows/bundle-desktop-linux.yml
dependabot[bot] 273ddedf21
chore(deps): bump actions/cache from 5.0.2 to 6.0.0 (#10051)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-30 21:07:41 +00:00

258 lines
8.6 KiB
YAML

# This is a **reuseable** workflow that bundles the Desktop App for Linux.
# It doesn't get triggered on its own. It gets used in multiple workflows:
# - release.yml
# - canary.yml (when added)
# - pr-comment-bundle-desktop.yml (when added)
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch name to bundle app from'
required: true
type: string
workflow_call:
inputs:
version:
description: 'Version to set for the build'
required: false
default: ""
type: string
ref:
type: string
required: false
default: ''
name: "Bundle Desktop (Linux)"
jobs:
build-desktop-linux:
name: Build Desktop (Linux, ${{ matrix.variant }})
runs-on: ${{ matrix.build-on }}
strategy:
fail-fast: false
matrix:
include:
- variant: standard
build-on: ubuntu-22.04
- variant: vulkan
build-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ inputs.ref || inputs.branch }}
- name: Update versions
if: ${{ inputs.version != '' }}
run: |
# Update version in Cargo.toml
sed -i.bak 's/^version = ".*"/version = "'${{ inputs.version }}'"/' Cargo.toml
rm -f Cargo.toml.bak
# Update version in package.json
source ./bin/activate-hermit
cd ui/desktop
npm pkg set "version=${{ inputs.version }}"
- name: Debug workflow info
env:
WORKFLOW_NAME: ${{ github.workflow }}
WORKFLOW_REF: ${{ github.ref }}
EVENT_NAME: ${{ github.event_name }}
REPOSITORY: ${{ github.repository }}
run: |
echo "=== Workflow Information ==="
echo "Workflow: ${WORKFLOW_NAME}"
echo "Ref: ${WORKFLOW_REF}"
echo "Event: ${EVENT_NAME}"
echo "Repo: ${REPOSITORY}"
echo ""
echo "=== System Information ==="
uname -a
lsb_release -a || true
df -h
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
libnss3-dev \
libatk-bridge2.0-dev \
libdrm2 \
libxcomposite1 \
libxdamage1 \
libxrandr2 \
libgbm1 \
libxss1 \
rpm \
fakeroot \
dpkg-dev \
protobuf-compiler \
flatpak \
flatpak-builder \
elfutils
if [ "${{ matrix.variant }}" = "vulkan" ]; then
sudo apt-get install -y \
libasound2t64 \
libvulkan-dev \
libvulkan1 \
glslc
else
sudo apt-get install -y libasound2
fi
- name: Configure RPM packaging
run: |
echo '%_build_id_links none' > ~/.rpmmacros
test "$(rpm --eval '%{_build_id_links}')" = "none"
- name: Setup Flatpak Runtimes
run: |
flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
- name: Activate hermit and set CARGO_HOME
run: |
source bin/activate-hermit
echo "CARGO_HOME=$CARGO_HOME" >> $GITHUB_ENV
echo "RUSTUP_HOME=$RUSTUP_HOME" >> $GITHUB_ENV
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
key: linux-${{ matrix.build-on }}-${{ matrix.variant }}
- name: Build goosed binary
env:
RUST_LOG: debug
RUST_BACKTRACE: 1
run: |
source ./bin/activate-hermit
export TARGET="x86_64-unknown-linux-gnu"
rustup target add "${TARGET}"
FEATURE_ARGS=()
if [ "${{ matrix.variant }}" = "vulkan" ]; then
FEATURE_ARGS=(--features vulkan)
fi
cargo build --release --target ${TARGET} -p goose-server "${FEATURE_ARGS[@]}"
- name: Copy binaries into Electron folder
run: |
echo "Copying binaries to ui/desktop/src/bin/"
export TARGET="x86_64-unknown-linux-gnu"
mkdir -p ui/desktop/src/bin
cp target/$TARGET/release/goosed ui/desktop/src/bin/
chmod +x ui/desktop/src/bin/goosed
ls -la ui/desktop/src/bin/
- name: Cache pnpm dependencies
uses: actions/cache@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # v6.0.0
with:
path: |
ui/desktop/node_modules
.hermit/node/cache
key: linux-pnpm-cache-v1-${{ runner.os }}-${{ hashFiles('ui/pnpm-lock.yaml') }}
restore-keys: |
linux-pnpm-cache-v1-${{ runner.os }}-
- name: Install pnpm dependencies
run: |
source ./bin/activate-hermit
cd ui/desktop
pnpm install --frozen-lockfile
# Verify installation
ls -la node_modules/.bin/ | head -5
- name: Build Linux packages
env:
GOOSE_DESKTOP_LINUX_VARIANT: ${{ matrix.variant }}
run: |
source ./bin/activate-hermit
cd ui/desktop
echo "Building Linux packages (.deb, .rpm, and .flatpak) for ${{ matrix.variant }}..."
# Build all configured packages
pnpm run make --platform=linux --arch=x64
if [ "${{ matrix.variant }}" = "vulkan" ]; then
for package in out/make/deb/x64/*.deb out/make/rpm/x64/*.rpm out/make/flatpak/x86_64/*.flatpak; do
[ -e "$package" ] || continue
extension="${package##*.}"
base="${package%.*}"
mv "$package" "${base}-vulkan.${extension}"
done
fi
for package in out/make/rpm/x64/*.rpm; do
package_contents="$(rpm -qlp "$package")"
if grep -qE '^/usr/lib/\.build-id(/|$)' <<< "$package_contents"; then
echo "::error file=$package::RPM contains build-id links"
exit 1
fi
done
echo "Build completed. Checking output..."
ls -la out/
find out/ -name "*.deb" -o -name "*.rpm" -o -name "*.flatpak" | head -10
- name: List generated files
run: |
echo "=== All files in out/ directory ==="
find ui/desktop/out/ -type f | head -20
echo ""
echo "=== Package files specifically ==="
find ui/desktop/out/ -name "*.deb" -o -name "*.rpm" -o -name "*.flatpak"
echo ""
echo "=== File sizes ==="
find ui/desktop/out/ -name "*.deb" -o -name "*.rpm" -o -name "*.flatpak" -exec ls -lh {} \;
- name: Upload .deb package
if: matrix.variant == 'standard'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Goose-linux-x64-deb
path: ui/desktop/out/make/deb/x64/*.deb
if-no-files-found: error
- name: Upload .deb package (Vulkan)
if: matrix.variant == 'vulkan'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Goose-linux-x64-vulkan-deb
path: ui/desktop/out/make/deb/x64/*-vulkan.deb
if-no-files-found: error
- name: Upload .rpm package
if: matrix.variant == 'standard'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Goose-linux-x64-rpm
path: ui/desktop/out/make/rpm/x64/*.rpm
if-no-files-found: error
- name: Upload .rpm package (Vulkan)
if: matrix.variant == 'vulkan'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Goose-linux-x64-vulkan-rpm
path: ui/desktop/out/make/rpm/x64/*-vulkan.rpm
if-no-files-found: error
- name: Upload .flatpak package
if: matrix.variant == 'standard'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Goose-linux-x64-flatpak
path: ui/desktop/out/make/flatpak/x86_64/*.flatpak
if-no-files-found: error
- name: Upload .flatpak package (Vulkan)
if: matrix.variant == 'vulkan'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Goose-linux-x64-vulkan-flatpak
path: ui/desktop/out/make/flatpak/x86_64/*-vulkan.flatpak
if-no-files-found: error