feat: add cross-platform release pipeline

This commit is contained in:
lofyer
2026-08-04 15:12:49 +08:00
parent ae9cfffb57
commit a7ee56ea4d
7 changed files with 1091 additions and 97 deletions
-84
View File
@@ -1,84 +0,0 @@
name: Linux packages
on:
workflow_dispatch:
push:
tags:
- 'v*'
permissions:
contents: read
jobs:
package:
name: ${{ matrix.arch }} AppImage and DEB
strategy:
fail-fast: false
matrix:
include:
- arch: x64
runner: ubuntu-24.04
deb_arch: amd64
elf_machine: x86-64
- arch: arm64
runner: ubuntu-24.04-arm
deb_arch: arm64
elf_machine: aarch64
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- name: Install packaging tools
run: |
sudo apt-get update
sudo apt-get install --yes file ruby ruby-dev build-essential
sudo gem install fpm --no-document
- name: Install dependencies
run: npm ci
- name: Run validators
run: |
npm test
npm run typecheck
npm run lint
- name: Build Linux packages
run: npm run dist:linux:${{ matrix.arch }}
- name: Verify package architecture and runtimes
shell: bash
run: |
set -euo pipefail
appimage="$(find dist -maxdepth 1 -type f -name '*.AppImage' -print -quit)"
deb="$(find dist -maxdepth 1 -type f -name '*.deb' -print -quit)"
unpacked="$(find dist -maxdepth 1 -type d -name 'linux*unpacked' -print -quit)"
test -n "$appimage"
test -n "$deb"
test -n "$unpacked"
file "$unpacked/goodbuddy" | grep -qi '${{ matrix.elf_machine }}'
file "$unpacked/resources/runtimes/opencode/opencode" | grep -qi '${{ matrix.elf_machine }}'
test -f "$unpacked/resources/runtimes/continue/dist/index.js"
"$unpacked/resources/runtimes/opencode/opencode" --version
dpkg-deb --field "$deb" Architecture | grep -qx '${{ matrix.deb_arch }}'
dpkg-deb --contents "$deb" | grep -q 'runtimes/opencode/opencode'
chmod +x "$appimage"
"$appimage" --appimage-extract >/dev/null
test -f squashfs-root/resources/runtimes/continue/dist/index.js
- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: goodbuddy-linux-${{ matrix.arch }}
path: |
dist/*.AppImage
dist/*.deb
dist/*.blockmap
if-no-files-found: error
+122
View File
@@ -0,0 +1,122 @@
name: Cross-platform packages
on:
workflow_dispatch:
push:
tags:
- 'v*'
permissions:
contents: read
env:
ELECTRON_CACHE: ${{ github.workspace }}/.cache/electron
ELECTRON_BUILDER_CACHE: ${{ github.workspace }}/.cache/electron-builder
concurrency:
group: packages-${{ github.ref }}
cancel-in-progress: true
jobs:
validate:
name: Validate source
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- name: Verify release tag version
if: github.ref_type == 'tag'
run: node -e "const p=require('./package.json'); const expected='v'+p.version; if(process.env.GITHUB_REF_NAME!==expected){throw new Error('Expected tag '+expected+', received '+process.env.GITHUB_REF_NAME)}"
- name: Install dependencies
run: npm ci
- name: Run validators
run: |
npm test
npm run typecheck
npm run lint
- name: Build production bundle
run: npm run build:bundle
- name: Upload production bundle
uses: actions/upload-artifact@v4
with:
name: goodbuddy-production-bundle
path: out
if-no-files-found: error
retention-days: 1
package:
name: ${{ matrix.platform }} ${{ matrix.arch }}
needs: validate
strategy:
fail-fast: false
matrix:
include:
- platform: windows
arch: x64
runner: windows-2025
- platform: windows
arch: arm64
runner: windows-2025
- platform: macos
arch: x64
runner: macos-15-intel
- platform: macos
arch: arm64
runner: macos-15
- platform: linux
arch: x64
runner: ubuntu-24.04
- platform: linux
arch: arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
timeout-minutes: 75
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- name: Cache packaging toolsets
uses: actions/cache@v4
with:
path: |
${{ env.ELECTRON_CACHE }}
${{ env.ELECTRON_BUILDER_CACHE }}
key: packaging-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('package-lock.json') }}
restore-keys: packaging-${{ runner.os }}-${{ matrix.arch }}-
- name: Install dependencies
run: npm ci
- name: Download production bundle
uses: actions/download-artifact@v4
with:
name: goodbuddy-production-bundle
path: out
- name: Build and verify release packages
run: npm run release:package -- --platform ${{ matrix.platform }} --arch ${{ matrix.arch }} --skip-build
- name: Upload release packages
uses: actions/upload-artifact@v4
with:
name: goodbuddy-${{ matrix.platform }}-${{ matrix.arch }}
path: dist/release/${{ matrix.platform }}-${{ matrix.arch }}
if-no-files-found: error
compression-level: 0
retention-days: 30