Author SHA1 Message Date
shadowdaoandClaude Opus 5 d218f4c6f3 Surface API errors in the publish step
The publish job has never run successfully. When it failed on the v1.0.0
tag it reported "SyntaxError: Unexpected end of JSON input" from piping an
empty curl body into JSON.parse, which said nothing about the actual cause
(an unset token). An opaque failure there costs a full three-platform build.

Routes every call through a helper that captures the HTTP status and prints
the response body on 4xx/5xx. Also switches artifact iteration to while-read
so filenames with spaces cannot split, and dumps the artifact tree when
nothing matches.

Helper verified against the live API: existing tag resolves to its release
id, a missing tag reports HTTP 404 with the body and yields an empty id so
the create path runs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-28 20:39:45 -07:00
jknapp 1f79d7bcfe Merge pull request 'Match actual runner labels and use the injected token' (#4) from fix/runner-labels into main 2026-08-29 01:57:08 +00:00
shadowdaoandClaude Opus 5 394dc7107c Match actual runner labels and use the injected token
The mac job targeted macos-arm64, but the registered Mac runner is
labelled macos-latest, so that job would have queued forever rather than
failing -- a job with no matching runner is silently pending.

Also switches the publish step to secrets.GITEA_TOKEN, which Gitea injects
automatically and scopes to the repo, instead of requiring a hand-created
RELEASE_TOKEN. RELEASE_TOKEN still overrides it if wider rights are needed.

Runners confirmed via /api/v1/admin/actions/runners: ubuntu-latest,
windows-latest (x2) and macos-latest are all online.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-28 18:56:58 -07:00
jknapp f8d10d3a24 Merge pull request 'Build each platform on its own native runner' (#3) from ci/native-builders into main 2026-08-29 01:53:39 +00:00
shadowdaoandClaude Opus 5 72485d44ff Build each platform on its own native runner
Splits the release workflow into linux, windows and macos jobs feeding a
single publish job. The publish step is separate so parallel builds cannot
race to create the release and fail on a duplicate tag.

Windows now builds natively, so signAndEditExecutable no longer has to be
disabled. That flag was suppressing rcedit, which is what embeds the icon
and version resources -- the v1.0.0 exe shipped with the stock Electron
icon as a result. Also adds an NSIS installer alongside the portable zip.

macOS gains a dmg target, which cannot be produced off macOS. Builds stay
unsigned pending a Developer ID, with CSC_IDENTITY_AUTO_DISCOVERY disabled
so electron-builder builds unsigned instead of failing on a real Mac.

Nothing cross-builds now; all three runners must be registered before
tagging, since a job with no matching runner queues silently.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-28 18:53:24 -07:00
2 changed files with 170 additions and 34 deletions
+157 -29
View File
@@ -1,8 +1,21 @@
name: Build AppImage
name: Build release artifacts
# Builds the Linux AppImage on a version tag and attaches it to a Gitea release.
# Tag must match the version in desktop-client/package.json, since electron-builder
# names the artifact from package.json (not from the tag).
# Builds each platform natively on a v* tag and publishes one Gitea release.
#
# Runners required. None are registered yet, and a job with no matching runner
# queues silently rather than failing, so register all three before tagging:
# ubuntu-latest Linux AppImage
# windows-latest Windows NSIS installer + portable zip
# macos-latest macOS dmg + zip, both architectures (M-series builds both)
#
# Nothing cross-builds any more: dmg requires macOS, and the Windows exe needs
# rcedit on Windows to get its icon and version resources.
#
# A RELEASE_TOKEN secret is optional; GITEA_TOKEN is used by default.
#
# All output is unsigned. Once certificates exist: for macOS drop mac.identity
# from package.json and remove CSC_IDENTITY_AUTO_DISCOVERY; for Windows add the
# cert secrets. Until then users hit Gatekeeper and SmartScreen warnings.
on:
push:
tags:
@@ -10,18 +23,19 @@ on:
workflow_dispatch:
jobs:
appimage:
linux:
runs-on: ubuntu-latest
defaults:
run:
working-directory: desktop-client
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
# Runs only here rather than in all three jobs: it is a repo-wide check,
# and this job uses bash, which is not guaranteed on the Windows runner.
- name: Verify tag matches package.json version
if: startsWith(github.ref, 'refs/tags/v')
run: |
@@ -29,7 +43,7 @@ jobs:
tag_version="${GITHUB_REF_NAME#v}"
if [ "$pkg_version" != "$tag_version" ]; then
echo "Tag $GITHUB_REF_NAME does not match package.json version $pkg_version." >&2
echo "Bump package.json before tagging, or the AppImage will be misnamed." >&2
echo "Bump package.json before tagging, or artifacts will be misnamed." >&2
exit 1
fi
@@ -42,31 +56,145 @@ jobs:
- name: Build AppImage
run: npx electron-builder --linux AppImage --publish never
- name: Attach AppImage to release
if: startsWith(github.ref, 'refs/tags/v')
- uses: actions/upload-artifact@v3
with:
name: linux
path: desktop-client/dist/*.AppImage
if-no-files-found: error
windows:
runs-on: windows-latest
defaults:
run:
working-directory: desktop-client
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Build installer and portable zip
run: npx electron-builder --win nsis zip --publish never
- uses: actions/upload-artifact@v3
with:
name: windows
path: |
desktop-client/dist/*.exe
desktop-client/dist/*-win-*.zip
if-no-files-found: error
macos:
runs-on: macos-latest
defaults:
run:
working-directory: desktop-client
env:
TOKEN: ${{ secrets.RELEASE_TOKEN }}
# No Developer ID yet: stop electron-builder auto-discovering an identity,
# which otherwise fails the build on a real Mac rather than building unsigned.
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Build dmg and zip (both architectures)
run: npx electron-builder --mac --x64 --arm64 --publish never
- uses: actions/upload-artifact@v3
with:
name: macos
path: |
desktop-client/dist/*.dmg
desktop-client/dist/*-mac-*.zip
if-no-files-found: error
publish:
# Separate job so only one process touches the release: parallel build jobs
# would race to create it and one would fail on the duplicate tag.
needs: [linux, windows, macos]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: Create release and attach artifacts
env:
# Gitea injects GITEA_TOKEN automatically, repo-scoped and short-lived.
# RELEASE_TOKEN is an optional override if wider rights are ever needed.
TOKEN: ${{ secrets.RELEASE_TOKEN || secrets.GITEA_TOKEN }}
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
run: |
set -euo pipefail
artifact=$(ls dist/*.AppImage | head -1)
echo "Publishing $artifact for $GITHUB_REF_NAME"
# Reuse the release if the tag already has one, otherwise create it.
release_id=$(curl -sf -H "Authorization: token $TOKEN" \
"$API/releases/tags/$GITHUB_REF_NAME" | node -p \
"JSON.parse(require('fs').readFileSync(0,'utf8')).id" 2>/dev/null || true)
if [ -z "${release_id:-}" ]; then
release_id=$(curl -sf -X POST -H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"$GITHUB_REF_NAME\",\"name\":\"$GITHUB_REF_NAME\"}" \
"$API/releases" | node -p \
"JSON.parse(require('fs').readFileSync(0,'utf8')).id")
if [ -z "${TOKEN:-}" ]; then
echo "No token available (GITEA_TOKEN missing and RELEASE_TOKEN unset)." >&2
exit 1
fi
curl -sf -X POST -H "Authorization: token $TOKEN" \
-F "attachment=@$artifact" \
"$API/releases/$release_id/assets?name=$(basename "$artifact")" \
-o /dev/null
echo "Attached $(basename "$artifact") to release $release_id"
# Report the HTTP status and body on failure. A bare `curl -sf | JSON.parse`
# dies with "Unexpected end of JSON input" and hides the real cause, which is
# how the v1.0.0 run failed on a missing token.
api() {
local method="$1" path="$2"; shift 2
local out code
out=$(curl -s -w '\n%{http_code}' -X "$method" \
-H "Authorization: token $TOKEN" "$API$path" "$@")
code=$(printf '%s' "$out" | tail -n1)
body=$(printf '%s' "$out" | sed '$d')
if [ "$code" -ge 400 ]; then
echo "$method $path -> HTTP $code" >&2
echo "$body" >&2
return 1
fi
printf '%s' "$body"
}
# Reuse the release if the tag already has one, otherwise create it.
release_id=$(api GET "/releases/tags/$GITHUB_REF_NAME" 2>/dev/null \
| node -pe "JSON.parse(require('fs').readFileSync(0,'utf8')).id" 2>/dev/null || true)
if [ -z "${release_id:-}" ]; then
echo "No release for $GITHUB_REF_NAME yet; creating it."
release_id=$(api POST "/releases" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"$GITHUB_REF_NAME\",\"name\":\"$GITHUB_REF_NAME\"}" \
| node -pe "JSON.parse(require('fs').readFileSync(0,'utf8')).id")
fi
if [ -z "${release_id:-}" ]; then
echo "Could not determine a release id." >&2
exit 1
fi
echo "Publishing to release $release_id"
# while-read rather than word-splitting a find, so spaces in names are safe.
found=0
while IFS= read -r f; do
name=$(basename "$f")
echo "Attaching $name ($(du -h "$f" | cut -f1))"
api POST "/releases/$release_id/assets?name=$name" -F "attachment=@$f" >/dev/null
found=$((found + 1))
done < <(find artifacts -type f \( -name '*.AppImage' -o -name '*.zip' \
-o -name '*.dmg' -o -name '*.exe' \) | sort)
if [ "$found" -eq 0 ]; then
echo "No artifacts found to attach; build jobs produced nothing." >&2
find artifacts -type f | head -20 >&2
exit 1
fi
echo "Attached $found artifacts to release $release_id"
+13 -5
View File
@@ -25,10 +25,11 @@
"main": "index.js"
},
"win": {
"target": "zip",
"sign": false,
"signAndEditExecutable": false,
"certificateSubjectName": null
"target": [
"nsis",
"zip"
],
"icon": "build/icon.png"
},
"linux": {
"target": [
@@ -42,10 +43,17 @@
"artifactName": "${productName}-${version}-${os}-${arch}.${ext}",
"mac": {
"target": [
"dmg",
"zip"
],
"icon": "build/icon.png",
"category": "public.app-category.music"
"category": "public.app-category.music",
"identity": null
},
"nsis": {
"oneClick": false,
"allowToChangeInstallationDirectory": true,
"perMachine": false
}
},
"dependencies": {