From 9a2cec8e21235818581a63af4b884148cabf49bf Mon Sep 17 00:00:00 2001 From: Axel Meyer Date: Tue, 3 Mar 2026 22:00:06 +0100 Subject: [PATCH] CI: make panel build optional, show apt-get errors, graceful fallbacks If CGO dependencies are missing, panel builds are skipped with a warning and the tray binary falls back to opening the browser. Co-Authored-By: Claude Opus 4.6 --- .gitea/workflows/release.yml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 741e6b0..92784cd 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -23,8 +23,8 @@ jobs: - name: Install build tools run: | - apt-get update -qq - apt-get install -y -qq gcc g++ mingw-w64 zip libwebkit2gtk-4.0-dev >/dev/null 2>&1 + apt-get update + apt-get install -y gcc g++ mingw-w64 zip libwebkit2gtk-4.0-dev || apt-get install -y gcc g++ mingw-w64 zip - name: Install nfpm run: | @@ -35,22 +35,29 @@ jobs: - name: Build Linux binaries run: | CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o syncwarden ./cmd/syncwarden - CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o syncwarden-panel ./cmd/panel CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o syncwarden-setup ./cmd/setup + CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o syncwarden-panel ./cmd/panel || echo "WARN: Linux panel build skipped (missing webkit2gtk-dev)" - name: Build Windows binaries run: | CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath -ldflags="-s -w -H=windowsgui" -o syncwarden.exe ./cmd/syncwarden - CGO_ENABLED=1 GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ go build -trimpath -ldflags="-s -w -H=windowsgui" -o syncwarden-panel.exe ./cmd/panel CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o syncwarden-setup.exe ./cmd/setup + CGO_ENABLED=1 GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ go build -trimpath -ldflags="-s -w -H=windowsgui" -o syncwarden-panel.exe ./cmd/panel || echo "WARN: Windows panel build skipped (missing mingw-w64)" - name: Build .deb package - run: VERSION=${{ env.VERSION }} nfpm package --config packaging/nfpm.yaml --packager deb --target syncwarden_${{ env.VERSION }}_amd64.deb + run: | + if [ -f syncwarden-panel ]; then + VERSION=${{ env.VERSION }} nfpm package --config packaging/nfpm.yaml --packager deb --target syncwarden_${{ env.VERSION }}_amd64.deb + else + sed '/syncwarden-panel/d' packaging/nfpm.yaml > /tmp/nfpm-nopanel.yaml + VERSION=${{ env.VERSION }} nfpm package --config /tmp/nfpm-nopanel.yaml --packager deb --target syncwarden_${{ env.VERSION }}_amd64.deb + fi - name: Create Linux tarball run: | mkdir -p dist/syncwarden-${{ env.VERSION }} - cp syncwarden syncwarden-panel syncwarden-setup dist/syncwarden-${{ env.VERSION }}/ + cp syncwarden syncwarden-setup dist/syncwarden-${{ env.VERSION }}/ + [ -f syncwarden-panel ] && cp syncwarden-panel dist/syncwarden-${{ env.VERSION }}/ || true cp README.md CHANGELOG.md LICENSE dist/syncwarden-${{ env.VERSION }}/ cp packaging/linux/syncwarden.desktop dist/syncwarden-${{ env.VERSION }}/ tar -czf syncwarden_${{ env.VERSION }}_linux_amd64.tar.gz -C dist syncwarden-${{ env.VERSION }} @@ -58,7 +65,8 @@ jobs: - name: Create Windows zip run: | mkdir -p dist-win/syncwarden-${{ env.VERSION }} - cp syncwarden.exe syncwarden-panel.exe syncwarden-setup.exe dist-win/syncwarden-${{ env.VERSION }}/ + cp syncwarden.exe syncwarden-setup.exe dist-win/syncwarden-${{ env.VERSION }}/ + [ -f syncwarden-panel.exe ] && cp syncwarden-panel.exe dist-win/syncwarden-${{ env.VERSION }}/ || true cp README.md CHANGELOG.md LICENSE dist-win/syncwarden-${{ env.VERSION }}/ cd dist-win && zip -r ../syncwarden_${{ env.VERSION }}_windows_amd64.zip syncwarden-${{ env.VERSION }}