Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ Tagged releases of `nsgo-dev/game` previously created text-only GitHub Releases

## Decision

Add a thin desktop application entrypoint in `cmd/editor` (`cmd/editor/main.go` + `cmd/editor/nsgo.yaml`) and extend `.github/workflows/release.yml` to build, sign, verify, and attach full desktop installers for **NSGo Game Editor** alongside prebuilt `nsgo-game` CLI archives on every release.
Add a thin desktop application entrypoint in `cmd/editor` (`cmd/editor/main.go` + `cmd/editor/nsgo.yaml`) and extend `.github/workflows/release.yml` to build, sign, verify, and attach full desktop installers for **NSGo Game Editor** on every release (keeping CLI workflows integrated under `nsgo game` rather than publishing separate `nsgo-game` archives).

### Packaging and signing contract

- `cmd/editor` delegates directly to `internal/gamecli.Run(editorArgs(os.Args[1:]))`, stripping macOS Finder's `-psn_*` flag so double-clicking the app opens the Start Screen while CLI invocations still accept project/scene/clip arguments.
- `cmd/editor/nsgo.yaml` declares `id: dev.nsgo.game.editor`, `release.github: nsgo-dev/game`, and `updates.key` matching the organization-wide `NSGO_UPDATES_KEY` secret so `go tool nsgo build` emits signed `appcast-<target>.xml` feeds, `install.sh`, `install.ps1`, and `.AppImage.zsync` files alongside every installer.
- `.github/workflows/release.yml` builds all six desktop targets on Depot runners (`depot-macos-15` for `macos_arm64`/`macos_x64` `.dmg`, `depot-ubuntu-24.04-4` for `linux_x64`/`linux_arm64` `.deb`/`.pkg.tar.gz`/`.AppImage` and `windows_x64`/`windows_arm64` `-setup.exe`), plus cross-compiled `nsgo-game` CLI archives for all six desktop OS/arch pairs.
- `.github/workflows/release.yml` builds all six desktop targets on Depot runners (`depot-macos-15` for `macos_arm64`/`macos_x64` `.dmg`, `depot-ubuntu-24.04-4` for `linux_x64`/`linux_arm64` `.deb`/`.pkg.tar.gz`/`.AppImage` and `windows_x64`/`windows_arm64` `-setup.exe`) and prepends a per-platform Downloads table to the GitHub Release body while keeping `release-notes.md` clean for in-app update prompts.
- macOS builds import the organization's Developer ID certificate (`MACOS_CERTIFICATE`, `MACOS_CERTIFICATE_PASSWORD`, `vars.MACOS_SIGNING_IDENTITY`) and App Store Connect API key (`APPSTORE_API_KEY_P8`, `APPSTORE_API_KEY_ID`, `APPSTORE_API_ISSUER_ID`), passing them to `go tool nsgo build` for hardened-runtime signing, notarization, and stapling, then verify every `.app` and `.dmg` with `codesign`, `xcrun stapler validate`, and `spctl --assess`. Non-release fork PRs without secrets fall back to ad hoc signing while tagged releases and `workflow_dispatch` uploads fail fast if signing or update secrets are missing.
- `workflow_dispatch` with an optional existing `tag` input (`mode=upload`) allows building and attaching signed editor and CLI assets onto an already-published release (such as `v0.1.0`) via `gh release upload --clobber` without moving or recreating the immutable Go module tag.
- `workflow_dispatch` with an optional existing `tag` input (`mode=upload`) allows building and attaching signed editor assets onto an already-published release (such as `v0.1.0`) via `gh release upload --clobber` without moving or recreating the immutable Go module tag.

## Alternatives considered

Expand Down
127 changes: 65 additions & 62 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name: Release
# Runs the full test and cross-target check suite on release tags, builds signed desktop
# installers for NSGo Game Editor (macOS signed & notarized with the org's Developer ID,
# Linux .deb / .pkg.tar.gz / .AppImage + install scripts, Windows -setup.exe installers,
# plus signed update appcasts via NSGO_UPDATES_KEY) and cross-platform nsgo-game CLI
# archives, then publishes them on the GitHub Release with notes extracted from CHANGELOG.md.
# plus signed update appcasts via NSGO_UPDATES_KEY), then publishes them on the GitHub
# Release with a platform downloads table and notes extracted from CHANGELOG.md.
#
# Pull requests touching cmd/editor or this workflow build and sign (when org secrets are
# available) without publishing. workflow_dispatch with an existing tag (for example v0.1.0)
# builds and uploads the editor and CLI assets onto that release without moving the tag.
# builds and uploads the editor assets onto that release without moving the tag.
on:
push:
tags:
Expand All @@ -20,7 +20,7 @@ on:
workflow_dispatch:
inputs:
tag:
description: "Optional existing release tag (e.g. v0.1.0) to build and upload editor/CLI assets onto; leave empty to dry-run."
description: "Optional existing release tag (e.g. v0.1.0) to build and upload editor assets onto; leave empty to dry-run."
required: false
type: string

Expand Down Expand Up @@ -437,59 +437,6 @@ jobs:
rm -f "$NOTARY_KEY"
security delete-keychain "$KEYCHAIN"

cli:
name: Build nsgo-game CLI
needs: meta
runs-on: depot-ubuntu-24.04-4
timeout-minutes: 20
steps:
- name: Check out
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- name: Build and archive nsgo-game for all desktop platforms
env:
VERSION: ${{ needs.meta.outputs.version }}
run: |
set -euo pipefail
out="$RUNNER_TEMP/cli"
mkdir -p "$out"
for pair in darwin/arm64 darwin/amd64 linux/amd64 linux/arm64 windows/amd64 windows/arm64; do
goos="${pair%/*}"
goarch="${pair#*/}"
os_label="$goos"
[ "$goos" = "darwin" ] && os_label="macos"
arch_label="$goarch"
[ "$goarch" = "amd64" ] && arch_label="x64"
bin="nsgo-game"
[ "$goos" = "windows" ] && bin="nsgo-game.exe"
stage="$RUNNER_TEMP/stage-${os_label}-${arch_label}"
mkdir -p "$stage"
CGO_ENABLED=0 GOOS="$goos" GOARCH="$goarch" go build -trimpath -o "$stage/$bin" ./cmd/nsgo-game
base="nsgo-game-${VERSION}-${os_label}-${arch_label}"
if [ "$goos" = "windows" ]; then
(cd "$stage" && zip -q "$out/${base}.zip" "$bin")
(cd "$out" && sha256sum "${base}.zip" > "${base}.zip.sha256")
else
tar -C "$stage" -czf "$out/${base}.tar.gz" "$bin"
(cd "$out" && sha256sum "${base}.tar.gz" > "${base}.tar.gz.sha256")
fi
done
ls -lh "$out"
- name: Upload CLI archives
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: cli-binaries
path: ${{ runner.temp }}/cli/
retention-days: 7
if-no-files-found: error

release:
name: Publish release
needs:
Expand All @@ -498,12 +445,10 @@ jobs:
- check
- apple
- editor
- cli
if: >-
always() &&
needs.meta.result == 'success' &&
needs.editor.result == 'success' &&
needs.cli.result == 'success' &&
(needs.test.result == 'success' || needs.test.result == 'skipped') &&
(needs.check.result == 'success' || needs.check.result == 'skipped') &&
(needs.apple.result == 'success' || needs.apple.result == 'skipped') &&
Expand All @@ -521,14 +466,14 @@ jobs:
- name: Download release assets
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: "*"
pattern: "editor-*"
path: ${{ runner.temp }}/downloads
- name: Assemble and verify asset checksums
run: |
set -euo pipefail
assets="$RUNNER_TEMP/assets"
mkdir -p "$assets"
for dir in "$RUNNER_TEMP"/downloads/editor-* "$RUNNER_TEMP"/downloads/cli-binaries; do
for dir in "$RUNNER_TEMP"/downloads/editor-*; do
[ -d "$dir" ] || continue
cp -- "$dir"/* "$assets/"
done
Expand All @@ -542,6 +487,63 @@ jobs:
fi
done
ls -lh "$assets"
- name: Prepend platform downloads table to GitHub release notes
env:
TAG: ${{ needs.meta.outputs.tag }}
VERSION: ${{ needs.meta.outputs.version }}
run: |
set -euo pipefail
base="https://github.com/${GITHUB_REPOSITORY}/releases/download/${TAG}"
ed="nsgo-game-editor-${VERSION}"

cat > "$RUNNER_TEMP/downloads-table.md" <<EOF
## Downloads

### Quick install (NSGo Game Editor)

- **macOS / Linux**:
\`\`\`sh
curl -fsSL ${base}/install.sh | sh
\`\`\`
- **Windows (PowerShell)**:
\`\`\`powershell
irm ${base}/install.ps1 | iex
\`\`\`

### NSGo Game Editor

| Platform | Architecture | Download | SHA-256 |
| --- | --- | --- | --- |
| **macOS** *(signed & notarized)* | Apple Silicon (\`arm64\`) | [\`${ed}-macos-arm64.dmg\`](${base}/${ed}-macos-arm64.dmg) | [\`.sha256\`](${base}/${ed}-macos-arm64.dmg.sha256) |
| **macOS** *(signed & notarized)* | Intel (\`x64\`) | [\`${ed}-macos-x64.dmg\`](${base}/${ed}-macos-x64.dmg) | [\`.sha256\`](${base}/${ed}-macos-x64.dmg.sha256) |
| **Windows** | \`x64\` | [\`${ed}-windows-x64-setup.exe\`](${base}/${ed}-windows-x64-setup.exe) | [\`.sha256\`](${base}/${ed}-windows-x64-setup.exe.sha256) |
| **Windows** | \`arm64\` | [\`${ed}-windows-arm64-setup.exe\`](${base}/${ed}-windows-arm64-setup.exe) | [\`.sha256\`](${base}/${ed}-windows-arm64-setup.exe.sha256) |
| **Linux** (Debian / Ubuntu) | \`x64\` / \`arm64\` | [\`.deb (x64)\`](${base}/${ed}-linux-x64.deb) · [\`.deb (arm64)\`](${base}/${ed}-linux-arm64.deb) | [\`x64\`](${base}/${ed}-linux-x64.deb.sha256) · [\`arm64\`](${base}/${ed}-linux-arm64.deb.sha256) |
| **Linux** (Arch) | \`x64\` / \`arm64\` | [\`.pkg.tar.gz (x64)\`](${base}/${ed}-linux-x64.pkg.tar.gz) · [\`.pkg.tar.gz (arm64)\`](${base}/${ed}-linux-arm64.pkg.tar.gz) | [\`x64\`](${base}/${ed}-linux-x64.pkg.tar.gz.sha256) · [\`arm64\`](${base}/${ed}-linux-arm64.pkg.tar.gz.sha256) |
| **Linux** (AppImage) | \`x64\` / \`arm64\` | [\`.AppImage (x64)\`](${base}/${ed}-linux-x64.AppImage) · [\`.AppImage (arm64)\`](${base}/${ed}-linux-arm64.AppImage) | [\`x64\`](${base}/${ed}-linux-x64.AppImage.sha256) · [\`arm64\`](${base}/${ed}-linux-arm64.AppImage.sha256) |

---

EOF

cat "$RUNNER_TEMP/downloads-table.md" "$RUNNER_TEMP/release-notes.md" > "$RUNNER_TEMP/github-release-notes.md"

# Keep the combined body (table + changelog) under GitHub Releases' 125,000-character limit.
max_chars=120000
if [ "$(wc -m < "$RUNNER_TEMP/github-release-notes.md")" -gt "$max_chars" ]; then
footer="$(printf '\n\n---\n\n_Release notes truncated to fit GitHub'\''s 125,000-character limit. See the full section in [CHANGELOG.md](https://github.com/%s/blob/%s/CHANGELOG.md)._\n' "$GITHUB_REPOSITORY" "$TAG")"
keep=$((max_chars - ${#footer}))
awk -v keep="$keep" '
{
add = length($0) + 1
if (total + add > keep) exit
print
total += add
}
' "$RUNNER_TEMP/github-release-notes.md" > "$RUNNER_TEMP/github-release-notes.truncated.md"
printf '%s' "$footer" >> "$RUNNER_TEMP/github-release-notes.truncated.md"
mv "$RUNNER_TEMP/github-release-notes.truncated.md" "$RUNNER_TEMP/github-release-notes.md"
fi
- name: Publish GitHub Release
env:
MODE: ${{ needs.meta.outputs.mode }}
Expand All @@ -552,11 +554,12 @@ jobs:
set -euo pipefail
if [ "$MODE" = "upload" ]; then
gh release upload "$TAG" --repo "$GITHUB_REPOSITORY" --clobber "$RUNNER_TEMP"/assets/*
gh release edit "$TAG" --repo "$GITHUB_REPOSITORY" --notes-file "$RUNNER_TEMP/github-release-notes.md"
exit 0
fi
title="NSGo Game ${VERSION}"
prerelease=()
if [[ "$VERSION" == *-* ]]; then
prerelease=(--prerelease)
fi
gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --verify-tag --title "$title" --notes-file "$RUNNER_TEMP/release-notes.md" "${prerelease[@]}" "$RUNNER_TEMP"/assets/*
gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --verify-tag --title "$title" --notes-file "$RUNNER_TEMP/github-release-notes.md" "${prerelease[@]}" "$RUNNER_TEMP"/assets/*
2 changes: 1 addition & 1 deletion changelog.d/release-editor-packages.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
### Added

- `cmd/editor`: standalone desktop application entrypoint (`NSGo Game Editor`) packaged and signed automatically on releases across macOS (`arm64`/`x64` `.dmg`, Developer ID signed and notarized), Linux (`x64`/`arm64` `.deb`, `.pkg.tar.gz`, `.AppImage`), and Windows (`x64`/`arm64` `-setup.exe`), alongside signed update appcasts, `install.sh`/`install.ps1` scripts, and prebuilt `nsgo-game` CLI archives.
- `cmd/editor`: standalone desktop application entrypoint (`NSGo Game Editor`) packaged and signed automatically on releases across macOS (`arm64`/`x64` `.dmg`, Developer ID signed and notarized), Linux (`x64`/`arm64` `.deb`, `.pkg.tar.gz`, `.AppImage`), and Windows (`x64`/`arm64` `-setup.exe`), alongside signed update appcasts and `install.sh`/`install.ps1` scripts.
2 changes: 1 addition & 1 deletion docs/en/editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This document records the scope decision for NSGo's game editor ([#159](https://github.com/nsgo-dev/game/issues/159)) and specifies the version 1 YAML scene format ([#160](https://github.com/nsgo-dev/game/issues/160)) implemented in `github.com/nsgo-dev/game/pkg/sceneformat`.

Prebuilt desktop installers for **NSGo Game Editor** (`cmd/editor`)—signed and notarized `.dmg` images for macOS (`arm64` / `x64`), `-setup.exe` installers for Windows (`x64` / `arm64`), and `.deb` / `.pkg.tar.gz` / `.AppImage` packages for Linux (`x64` / `arm64`)—are published on [GitHub Releases](https://github.com/nsgo-dev/game/releases/latest), alongside one-line installers (`install.sh` / `install.ps1`) and prebuilt `nsgo-game` CLI archives. You can also launch the editor directly via `nsgo game editor` or `go run ./cmd/editor`.
Prebuilt desktop installers for **NSGo Game Editor** (`cmd/editor`)—signed and notarized `.dmg` images for macOS (`arm64` / `x64`), `-setup.exe` installers for Windows (`x64` / `arm64`), and `.deb` / `.pkg.tar.gz` / `.AppImage` packages for Linux (`x64` / `arm64`)—are published on [GitHub Releases](https://github.com/nsgo-dev/game/releases/latest), alongside one-line installers (`install.sh` / `install.ps1`). You can also launch the editor directly via `nsgo game editor` or `go run ./cmd/editor`.

## Editor Scope Decision (#159)

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

本文档记录 NSGo 游戏编辑器的范围决策([#159](https://github.com/nsgo-dev/game/issues/159)),并说明 `github.com/nsgo-dev/game/pkg/sceneformat` 实现的第 1 版 YAML 场景格式([#160](https://github.com/nsgo-dev/game/issues/160))。

独立桌面版 **NSGo Game Editor**(`cmd/editor`)安装包已在 [GitHub Releases](https://github.com/nsgo-dev/game/releases/latest) 自动发布——包含经组织 Developer ID 签名与 Apple 公证的 macOS `.dmg`(`arm64` / `x64`)、Windows `-setup.exe`(`x64` / `arm64`)与 Linux `.deb` / `.pkg.tar.gz` / `.AppImage`(`x64` / `arm64`),并附带一键安装脚本(`install.sh` / `install.ps1`)与预编译 `nsgo-game` 命令行工具。也可通过 `nsgo game editor` 或 `go run ./cmd/editor` 直接启动。
独立桌面版 **NSGo Game Editor**(`cmd/editor`)安装包已在 [GitHub Releases](https://github.com/nsgo-dev/game/releases/latest) 自动发布——包含经组织 Developer ID 签名与 Apple 公证的 macOS `.dmg`(`arm64` / `x64`)、Windows `-setup.exe`(`x64` / `arm64`)与 Linux `.deb` / `.pkg.tar.gz` / `.AppImage`(`x64` / `arm64`),并附带一键安装脚本(`install.sh` / `install.ps1`)。也可通过 `nsgo game editor` 或 `go run ./cmd/editor` 直接启动。

## 编辑器范围决策(#159)

Expand Down