Files
AgentCompany/.github/workflows/build.yml
T
ZacharyZhang-NY 4df7f600d8 Bypass Actions artifact quota for the snapshot build branch
The native runners successfully package every requested platform, but Actions artifact upload is blocked by the repository storage quota. This workflow revision sends build outputs to a temporary draft GitHub release instead so the binaries remain downloadable for Cloudflare publication.

Constraint: GitHub Actions artifact storage quota is exhausted for this repository
Rejected: Continue using actions/upload-artifact | every build finished packaging and then failed on upload
Confidence: medium
Scope-risk: narrow
Directive: This release-upload path is for the temporary snapshot branch; do not keep it on the main workflow without deciding how permanent release transport should work
Tested: prior run packaged macOS, Windows x64-ia32, Windows arm64, Linux x64, and Linux arm64 before upload failure
Not-tested: Draft-release upload path before rerun
2026-04-04 03:40:59 -04:00

266 lines
9.0 KiB
YAML

name: Build & Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
publish:
description: 'Publish to GitHub Releases'
required: false
type: boolean
default: false
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
env:
PNPM_VERSION: '10.24.0'
NODE_VERSION: '22'
CI_RELEASE_TAG: ci-build-${{ github.run_id }}
jobs:
# ─────────────────────────────────────────────
# Stage 1: Lint & Typecheck (fast feedback)
# ─────────────────────────────────────────────
check:
name: Lint & Typecheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm typecheck
- run: pnpm lint
- run: pnpm typecheck:all
# ─────────────────────────────────────────────
# Stage 2: Unit Tests
# ─────────────────────────────────────────────
test:
name: Unit Tests
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm test:unit
- run: pnpm test:integration
# ─────────────────────────────────────────────
# Stage 3: Build matrix (parallel per platform)
# ─────────────────────────────────────────────
build-macos:
name: macOS (${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
needs: test
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- arch: arm64
runner: macos-14
builder_args: --mac --arm64
- arch: x64
runner: macos-15
builder_args: --mac --x64
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Decode signing certificate
if: env.CERT_B64 != ''
env:
CERT_B64: ${{ secrets.MAC_CERTIFICATE_P12_BASE64 }}
run: echo "$CERT_B64" | base64 --decode > /tmp/cert.p12
- name: Build electron-vite
run: pnpm exec electron-vite build
- name: Package & sign
run: pnpm exec electron-builder ${{ matrix.builder_args }} --config electron-builder.yml --publish never
env:
CSC_LINK: ${{ secrets.MAC_CERTIFICATE_P12_BASE64 != '' && '/tmp/cert.p12' || '' }}
CSC_KEY_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }}
CSC_IDENTITY_AUTO_DISCOVERY: ${{ secrets.MAC_CERTIFICATE_P12_BASE64 != '' && 'true' || 'false' }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
- name: Upload release files
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release view "$CI_RELEASE_TAG" >/dev/null 2>&1 || \
gh release create "$CI_RELEASE_TAG" \
--draft \
--prerelease \
--title "CI Build $GITHUB_RUN_ID" \
--notes "Temporary build artifact transport for Cloudflare publication." \
--target "$GITHUB_SHA"
gh release upload "$CI_RELEASE_TAG" \
build/release/*.dmg \
build/release/*.zip \
build/release/*.blockmap \
build/release/latest-mac.yml \
--clobber
build-windows:
name: Windows (${{ matrix.arch }})
runs-on: windows-latest
needs: test
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- arch: x64-ia32
builder_args: --win --x64 --ia32
- arch: arm64
builder_args: --win --arm64
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Build electron-vite
run: pnpm exec electron-vite build
- name: Package
run: pnpm exec electron-builder ${{ matrix.builder_args }} --config electron-builder.yml --publish never
env:
CSC_LINK: ${{ secrets.WIN_CERTIFICATE_P12_BASE64 }}
CSC_KEY_PASSWORD: ${{ secrets.WIN_CERTIFICATE_PASSWORD }}
- name: Upload release files
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release view "$CI_RELEASE_TAG" >/dev/null 2>&1 || \
gh release create "$CI_RELEASE_TAG" \
--draft \
--prerelease \
--title "CI Build $GITHUB_RUN_ID" \
--notes "Temporary build artifact transport for Cloudflare publication." \
--target "$GITHUB_SHA"
gh release upload "$CI_RELEASE_TAG" \
build/release/*.exe \
build/release/*.blockmap \
build/release/latest.yml \
--clobber
build-linux:
name: Linux (${{ matrix.arch }})
runs-on: ubuntu-latest
needs: test
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- arch: x64
builder_args: --linux --x64
- arch: arm64
builder_args: --linux --arm64
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Install snapcraft (x64 only)
if: matrix.arch == 'x64'
run: sudo snap install snapcraft --classic
- name: Build electron-vite
run: pnpm exec electron-vite build
- name: Package
run: pnpm exec electron-builder ${{ matrix.builder_args }} --config electron-builder.yml --publish never
- name: Upload release files
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release view "$CI_RELEASE_TAG" >/dev/null 2>&1 || \
gh release create "$CI_RELEASE_TAG" \
--draft \
--prerelease \
--title "CI Build $GITHUB_RUN_ID" \
--notes "Temporary build artifact transport for Cloudflare publication." \
--target "$GITHUB_SHA"
gh release upload "$CI_RELEASE_TAG" \
build/release/*.AppImage \
build/release/*.deb \
build/release/*.rpm \
build/release/*.blockmap \
build/release/latest-linux.yml \
--clobber
# ─────────────────────────────────────────────
# Stage 4: Publish Release
# ─────────────────────────────────────────────
release:
name: Publish Release
runs-on: ubuntu-latest
needs: [build-macos, build-windows, build-linux]
if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.publish == 'true'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: false
- name: Collect release files
run: |
mkdir -p release-files
find artifacts -type f \( \
-name "*.dmg" -o -name "*.zip" -o -name "*.exe" \
-o -name "*.AppImage" -o -name "*.deb" -o -name "*.rpm" \
-o -name "*.snap" -o -name "*.blockmap" \
-o -name "latest*.yml" \
\) -exec cp {} release-files/ \;
ls -lh release-files/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
files: release-files/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}