From d75c80c05a9b7209584b6698148c78359694c3b4 Mon Sep 17 00:00:00 2001 From: N0VAN0M4LY <224130499+N0VAN0M4LY@users.noreply.github.com> Date: Tue, 1 Dec 2026 20:34:50 +0800 Subject: [PATCH] feat(repo): add launcher release workflow Build, sign, and publish the Windows installer on a v tag. The release is created as a draft so its three files and note can be reviewed before publication. --- .github/workflows/launcher-release.yml | 90 ++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 .github/workflows/launcher-release.yml diff --git a/.github/workflows/launcher-release.yml b/.github/workflows/launcher-release.yml new file mode 100644 index 0000000..8b0ba52 --- /dev/null +++ b/.github/workflows/launcher-release.yml @@ -0,0 +1,90 @@ +# Build, sign, and publish a Windows installer of the WTOffline Launcher as a GitHub release +# tagged v. The launcher's update check reads v releases and expects all three +# files (installer, manifest, signature); a release missing any of them breaks the check for +# already-installed launchers. +# +# Start it either way: +# - push a tag: git tag v0.1.0 && git push origin v0.1.0 +# - from the Actions page (Run workflow), giving the version; the tag is created on the chosen +# branch's latest commit. +# The release note comes from .github/release-notes/v.md. The signing key comes from the +# repository secret PATCH_SIGNING_KEY (the same Ed25519 key used for adaptation packs). +name: Launcher release + +on: + push: + tags: ['v*'] + workflow_dispatch: + inputs: + version: + description: 'Launcher version, e.g. 0.1.0 (must match apps/launcher/package.json)' + required: true + type: string + draft: + description: 'Keep the release as a draft for editing before publication' + type: boolean + default: true + +permissions: + contents: write + +jobs: + release: + runs-on: windows-latest + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 24 + cache: npm + + - name: Install dependencies (downloads the Electron runtime) + run: npm ci + + - name: Resolve and verify the version + run: | + if [ "${{ github.event_name }}" = 'workflow_dispatch' ]; then + VERSION="${{ inputs.version }}" + else + VERSION="${GITHUB_REF_NAME#v}" + fi + PKG_VERSION=$(node -p "require('./apps/launcher/package.json').version") + if [ "$VERSION" != "$PKG_VERSION" ]; then + echo "Version $VERSION does not match apps/launcher/package.json ($PKG_VERSION)" >&2 + exit 1 + fi + echo "VERSION=$VERSION" >> "$GITHUB_ENV" + + - name: Typecheck + run: | + npm run typecheck + npm run typecheck --workspace "@wto/launcher" + + - name: Build and package the Windows installer + run: npm --workspace "@wto/launcher" run package:win + + - name: Sign the release + env: + PATCH_SIGNING_KEY: ${{ secrets.PATCH_SIGNING_KEY }} + run: node scripts/sign-launcher-release.ts + + - name: Create the release + env: + GH_TOKEN: ${{ github.token }} + run: | + flags=(--draft) + if [ "${{ github.event_name }}" = 'workflow_dispatch' ] && [ "${{ inputs.draft }}" = 'false' ]; then + flags=() + fi + gh release create "v$VERSION" \ + "build/windows-installer/wtoffline-launcher-$VERSION-win-x64.exe" \ + "build/windows-installer/wtoffline-launcher-$VERSION-win-x64.manifest.json" \ + "build/windows-installer/wtoffline-launcher-$VERSION-win-x64.manifest.json.sig" \ + "${flags[@]}" \ + --title "WTOffline Launcher $VERSION" \ + --notes-file ".github/release-notes/v$VERSION.md" \ + --target "$GITHUB_SHA"