Update release-bundle.yml

This commit is contained in:
mingzhi1 2026-03-03 10:51:51 +08:00
parent aaf467eba5
commit 48c34f6db6

View file

@ -92,6 +92,9 @@ jobs:
with: with:
go-version-file: go.mod go-version-file: go.mod
- name: Generate embedded assets
run: go generate ./...
- name: Build picoclaw - name: Build picoclaw
env: env:
GOOS: ${{ matrix.goos }} GOOS: ${{ matrix.goos }}
@ -120,11 +123,13 @@ jobs:
# ────────────────────────────────────────────────────────────────────────── # ──────────────────────────────────────────────────────────────────────────
# 3a. Build Launcher — Windows (Wails requires WebView2) # 3a. Build Launcher — Windows (Wails requires WebView2)
# Note: continue-on-error=true so packaging still runs if wails build fails
# ────────────────────────────────────────────────────────────────────────── # ──────────────────────────────────────────────────────────────────────────
build-launcher-windows: build-launcher-windows:
name: Build launcher (windows/amd64) name: Build launcher (windows/amd64)
needs: create-tag needs: create-tag
runs-on: windows-latest runs-on: windows-latest
continue-on-error: true
permissions: permissions:
contents: read contents: read
steps: steps:
@ -139,19 +144,9 @@ jobs:
with: with:
go-version-file: go.mod go-version-file: go.mod
- name: Embed Windows resources
working-directory: cmd/picoclaw-launcher
run: |
go tool go-winres make `
--in winres/winres.json `
--out rsrc `
--product-version=${{ inputs.tag }} `
--file-version=${{ inputs.tag }}
- name: Build launcher - name: Build launcher
working-directory: cmd/picoclaw-launcher
run: | run: |
go tool wails build -tags stdjson -ldflags "-s -w" -o picoclaw-launcher.exe go tool wails build -tags stdjson -ldflags "-s -w" -o picoclaw-launcher.exe -appdir cmd/picoclaw-launcher
- name: Upload launcher artifact - name: Upload launcher artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@ -167,6 +162,7 @@ jobs:
name: Build launcher (linux/amd64) name: Build launcher (linux/amd64)
needs: create-tag needs: create-tag
runs-on: ubuntu-latest runs-on: ubuntu-latest
continue-on-error: true
permissions: permissions:
contents: read contents: read
steps: steps:
@ -191,9 +187,8 @@ jobs:
go-version-file: go.mod go-version-file: go.mod
- name: Build launcher - name: Build launcher
working-directory: cmd/picoclaw-launcher
run: | run: |
go tool wails build -tags stdjson -ldflags "-s -w" -o picoclaw-launcher go tool wails build -tags stdjson -ldflags "-s -w" -o picoclaw-launcher -appdir cmd/picoclaw-launcher
- name: Upload launcher artifact - name: Upload launcher artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@ -209,6 +204,7 @@ jobs:
name: Build launcher (darwin/universal) name: Build launcher (darwin/universal)
needs: create-tag needs: create-tag
runs-on: macos-latest runs-on: macos-latest
continue-on-error: true
permissions: permissions:
contents: read contents: read
steps: steps:
@ -224,9 +220,8 @@ jobs:
go-version-file: go.mod go-version-file: go.mod
- name: Build launcher (universal) - name: Build launcher (universal)
working-directory: cmd/picoclaw-launcher
run: | run: |
go tool wails build -tags stdjson -ldflags "-s -w" -platform darwin/universal -o picoclaw-launcher go tool wails build -tags stdjson -ldflags "-s -w" -platform darwin/universal -o picoclaw-launcher -appdir cmd/picoclaw-launcher
- name: Upload launcher artifact - name: Upload launcher artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@ -237,6 +232,8 @@ jobs:
# ────────────────────────────────────────────────────────────────────────── # ──────────────────────────────────────────────────────────────────────────
# 4. Package: assemble zip bundles per platform and create GitHub Release # 4. Package: assemble zip bundles per platform and create GitHub Release
# Runs even if launcher builds fail (if: ${{ !cancelled() }})
# Launcher is included only if its artifact was successfully uploaded
# ────────────────────────────────────────────────────────────────────────── # ──────────────────────────────────────────────────────────────────────────
package-and-release: package-and-release:
name: Package & Create Release name: Package & Create Release
@ -245,124 +242,152 @@ jobs:
- build-launcher-windows - build-launcher-windows
- build-launcher-linux - build-launcher-linux
- build-launcher-macos - build-launcher-macos
# Run even if launcher jobs fail; only skip if workflow is cancelled
if: ${{ !cancelled() && needs.build-picoclaw.result == 'success' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
steps: steps:
- name: Checkout tag (for release notes) - name: Checkout tag
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
ref: ${{ inputs.tag }} ref: ${{ inputs.tag }}
# ── Download all build artifacts ── # ── Download picoclaw artifacts (always present) ──
- name: Download all artifacts - name: Download picoclaw artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
pattern: picoclaw-*
path: artifacts path: artifacts
merge-multiple: false
# ── Download launcher artifacts (may be missing if build failed) ──
- name: Download launcher-windows artifact
uses: actions/download-artifact@v4
if: ${{ needs.build-launcher-windows.result == 'success' }}
with:
name: launcher-windows-amd64
path: artifacts/launcher-windows-amd64
continue-on-error: true
- name: Download launcher-linux artifact
uses: actions/download-artifact@v4
if: ${{ needs.build-launcher-linux.result == 'success' }}
with:
name: launcher-linux-amd64
path: artifacts/launcher-linux-amd64
continue-on-error: true
- name: Download launcher-macos artifact
uses: actions/download-artifact@v4
if: ${{ needs.build-launcher-macos.result == 'success' }}
with:
name: launcher-darwin-universal
path: artifacts/launcher-darwin-universal
continue-on-error: true
- name: List downloaded artifacts - name: List downloaded artifacts
run: find artifacts -type f | sort run: find artifacts -type f | sort
# ── Helper: make platform bundles ── # ── Assemble zip bundles ──
- name: Assemble zip bundles - name: Assemble zip bundles
env: env:
TAG: ${{ inputs.tag }} TAG: ${{ inputs.tag }}
run: | run: |
set -euo pipefail set -euo pipefail
mkdir -p release mkdir -p release staging
make_bundle() { # ── helper: bundle picoclaw + optional launcher into a zip ──
local NAME="$1" # e.g. picoclaw_v0.2.0_windows_amd64 make_zip() {
local PICOCLAW_SRC="$2" # path to picoclaw binary local NAME="$1" # bundle name, e.g. picoclaw_v0.1.0_windows_amd64
local LAUNCHER_SRC="$3" # path to launcher binary local PICOCLAW="$2" # source path of picoclaw binary
local EXT="$4" # "" or ".exe" local LAUNCHER="${3:-}" # source path of launcher binary (empty = omit)
local EXT="${4:-}" # ".exe" or ""
local DIR="staging/${NAME}" local DIR="staging/${NAME}"
mkdir -p "${DIR}" mkdir -p "${DIR}"
cp "${PICOCLAW_SRC}" "${DIR}/picoclaw${EXT}" chmod +x "${PICOCLAW}" 2>/dev/null || true
cp "${LAUNCHER_SRC}" "${DIR}/picoclaw-launcher${EXT}" cp "${PICOCLAW}" "${DIR}/picoclaw${EXT}"
# Add README if [ -n "${LAUNCHER}" ] && [ -f "${LAUNCHER}" ]; then
cat > "${DIR}/README.txt" <<'EOF' chmod +x "${LAUNCHER}" 2>/dev/null || true
PicoClaw Bundle cp "${LAUNCHER}" "${DIR}/picoclaw-launcher${EXT}"
=============== echo "PicoClaw Bundle (picoclaw + picoclaw-launcher)" > "${DIR}/README.txt"
picoclaw - CLI agent / gateway (headless)
picoclaw-launcher - Desktop GUI launcher
Quick start:
1. Run picoclaw-launcher to configure and start the agent.
2. Or run picoclaw directly: picoclaw --help
EOF
if [ "${EXT}" = ".exe" ]; then
(cd staging && zip -r "../release/${NAME}.zip" "${NAME}/")
else else
tar -czf "release/${NAME}.tar.gz" -C staging "${NAME}/" echo "PicoClaw CLI only (picoclaw-launcher not available for this platform)" > "${DIR}/README.txt"
fi fi
echo " → release/${NAME}.zip / .tar.gz"
(cd staging && zip -r "../release/${NAME}.zip" "${NAME}/")
echo " created: release/${NAME}.zip"
} }
# Windows WINLAUNCHER=""
make_bundle \ LINLAUNCHER=""
MACLAUNCHER=""
[ -f "artifacts/launcher-windows-amd64/picoclaw-launcher.exe" ] \
&& WINLAUNCHER="artifacts/launcher-windows-amd64/picoclaw-launcher.exe"
[ -f "artifacts/launcher-linux-amd64/picoclaw-launcher" ] \
&& LINLAUNCHER="artifacts/launcher-linux-amd64/picoclaw-launcher"
[ -f "artifacts/launcher-darwin-universal/picoclaw-launcher" ] \
&& MACLAUNCHER="artifacts/launcher-darwin-universal/picoclaw-launcher"
# Windows amd64
make_zip \
"picoclaw_${TAG}_windows_amd64" \ "picoclaw_${TAG}_windows_amd64" \
"artifacts/picoclaw-windows-amd64/picoclaw.exe" \ "artifacts/picoclaw-windows-amd64/picoclaw.exe" \
"artifacts/launcher-windows-amd64/picoclaw-launcher.exe" \ "${WINLAUNCHER}" \
".exe" ".exe"
# Linux amd64 # Linux amd64
chmod +x artifacts/picoclaw-linux-amd64/picoclaw \ make_zip \
artifacts/launcher-linux-amd64/picoclaw-launcher
make_bundle \
"picoclaw_${TAG}_linux_amd64" \ "picoclaw_${TAG}_linux_amd64" \
"artifacts/picoclaw-linux-amd64/picoclaw" \ "artifacts/picoclaw-linux-amd64/picoclaw" \
"artifacts/launcher-linux-amd64/picoclaw-launcher" \ "${LINLAUNCHER}" \
"" ""
# macOS universal # macOS amd64 (with universal launcher if available)
chmod +x artifacts/picoclaw-darwin-amd64/picoclaw \ make_zip \
artifacts/launcher-darwin-universal/picoclaw-launcher "picoclaw_${TAG}_darwin_amd64" \
make_bundle \
"picoclaw_${TAG}_darwin_universal" \
"artifacts/picoclaw-darwin-amd64/picoclaw" \ "artifacts/picoclaw-darwin-amd64/picoclaw" \
"artifacts/launcher-darwin-universal/picoclaw-launcher" \ "${MACLAUNCHER}" \
"" ""
# macOS arm64 (same launcher as universal) # macOS arm64 (with universal launcher if available)
chmod +x artifacts/picoclaw-darwin-arm64/picoclaw make_zip \
make_bundle \
"picoclaw_${TAG}_darwin_arm64" \ "picoclaw_${TAG}_darwin_arm64" \
"artifacts/picoclaw-darwin-arm64/picoclaw" \ "artifacts/picoclaw-darwin-arm64/picoclaw" \
"artifacts/launcher-darwin-universal/picoclaw-launcher" \ "${MACLAUNCHER}" \
"" ""
# Linux arm64 (launcher not built; picoclaw only bundle) # Linux arm64 (picoclaw only)
chmod +x artifacts/picoclaw-linux-arm64/picoclaw make_zip \
mkdir -p staging/picoclaw_${TAG}_linux_arm64 "picoclaw_${TAG}_linux_arm64" \
cp artifacts/picoclaw-linux-arm64/picoclaw staging/picoclaw_${TAG}_linux_arm64/picoclaw "artifacts/picoclaw-linux-arm64/picoclaw" \
tar -czf release/picoclaw_${TAG}_linux_arm64.tar.gz -C staging picoclaw_${TAG}_linux_arm64/ "" ""
# Linux armv7 # Linux armv7 (picoclaw only)
chmod +x artifacts/picoclaw-linux-arm-armv7/picoclaw make_zip \
mkdir -p staging/picoclaw_${TAG}_linux_armv7 "picoclaw_${TAG}_linux_armv7" \
cp artifacts/picoclaw-linux-arm-armv7/picoclaw staging/picoclaw_${TAG}_linux_armv7/picoclaw "artifacts/picoclaw-linux-arm-armv7/picoclaw" \
tar -czf release/picoclaw_${TAG}_linux_armv7.tar.gz -C staging picoclaw_${TAG}_linux_armv7/ "" ""
# Linux riscv64 # Linux riscv64 (picoclaw only)
chmod +x artifacts/picoclaw-linux-riscv64/picoclaw make_zip \
mkdir -p staging/picoclaw_${TAG}_linux_riscv64 "picoclaw_${TAG}_linux_riscv64" \
cp artifacts/picoclaw-linux-riscv64/picoclaw staging/picoclaw_${TAG}_linux_riscv64/picoclaw "artifacts/picoclaw-linux-riscv64/picoclaw" \
tar -czf release/picoclaw_${TAG}_linux_riscv64.tar.gz -C staging picoclaw_${TAG}_linux_riscv64/ "" ""
# Linux loong64 # Linux loong64 (picoclaw only)
chmod +x artifacts/picoclaw-linux-loong64/picoclaw make_zip \
mkdir -p staging/picoclaw_${TAG}_linux_loong64 "picoclaw_${TAG}_linux_loong64" \
cp artifacts/picoclaw-linux-loong64/picoclaw staging/picoclaw_${TAG}_linux_loong64/picoclaw "artifacts/picoclaw-linux-loong64/picoclaw" \
tar -czf release/picoclaw_${TAG}_linux_loong64.tar.gz -C staging picoclaw_${TAG}_linux_loong64/ "" ""
echo "" echo ""
echo "Final release assets:" echo "=== Final release assets ==="
ls -lh release/ ls -lh release/
# ── Create GitHub Release ── # ── Create GitHub Release ──
@ -374,6 +399,6 @@ jobs:
draft: ${{ inputs.draft }} draft: ${{ inputs.draft }}
prerelease: ${{ inputs.prerelease }} prerelease: ${{ inputs.prerelease }}
generate_release_notes: true generate_release_notes: true
files: release/* files: release/*.zip
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}