mirror of
https://github.com/block/goose.git
synced 2026-04-28 03:29:36 +00:00
185 lines
6 KiB
YAML
185 lines
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_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)
|
|
runs-on: ubuntu-x86-16core-64gb
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
|
with:
|
|
ref: ${{ inputs.ref }}
|
|
|
|
- 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
|
|
pnpm version ${{ inputs.version }} --no-git-tag-version --allow-same-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 \
|
|
libasound2t64 \
|
|
rpm \
|
|
fakeroot \
|
|
dpkg-dev \
|
|
protobuf-compiler \
|
|
flatpak \
|
|
flatpak-builder \
|
|
elfutils
|
|
|
|
- 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: Install cross
|
|
run: source ./bin/activate-hermit && cargo install cross --git https://github.com/cross-rs/cross
|
|
|
|
- name: Cache Rust dependencies
|
|
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
|
|
with:
|
|
key: linux
|
|
|
|
- name: Build goosed binary
|
|
env:
|
|
CROSS_NO_WARNINGS: 0
|
|
RUST_LOG: debug
|
|
RUST_BACKTRACE: 1
|
|
CROSS_VERBOSE: 1
|
|
CC: gcc-10
|
|
run: |
|
|
source ./bin/activate-hermit
|
|
export TARGET="x86_64-unknown-linux-gnu"
|
|
rustup target add "${TARGET}"
|
|
cross build --release --target ${TARGET} -p goose-server
|
|
|
|
- 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@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
|
|
with:
|
|
path: |
|
|
ui/desktop/node_modules
|
|
.hermit/node/cache
|
|
key: linux-pnpm-cache-v1-${{ runner.os }}-${{ hashFiles('ui/desktop/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
|
|
run: |
|
|
source ./bin/activate-hermit
|
|
cd ui/desktop
|
|
echo "Building Linux packages (.deb, .rpm, and .flatpak)..."
|
|
|
|
# Build all configured packages
|
|
pnpm run make -- --platform=linux --arch=x64
|
|
|
|
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
|
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
|
with:
|
|
name: Goose-linux-x64-deb
|
|
path: ui/desktop/out/make/deb/x64/*.deb
|
|
if-no-files-found: error
|
|
|
|
- name: Upload .rpm package
|
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
|
with:
|
|
name: Goose-linux-x64-rpm
|
|
path: ui/desktop/out/make/rpm/x64/*.rpm
|
|
if-no-files-found: error
|
|
|
|
- name: Upload .flatpak package
|
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
|
with:
|
|
name: Goose-linux-x64-flatpak
|
|
path: ui/desktop/out/make/flatpak/x86_64/*.flatpak
|
|
if-no-files-found: error
|