Files
WT-Offline/.github/workflows/launcher-release.yml
T

98 lines
3.6 KiB
YAML

# Build, sign, and publish a Windows installer of the WTOffline Launcher as a GitHub release
# tagged v<version>. The launcher's update check reads v<version> releases and expects the three
# signed files (installer, manifest, signature); a release missing any of them breaks the check
# for already-installed launchers. The workflow also packages and signs the portable zip with its
# own manifest and signature so portable installations can update in place.
#
# 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<version>.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
run: npm ci
- name: Download the Electron runtime
run: node node_modules/electron/install.js
- 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 and portable archive
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" \
"build/windows-installer/wtoffline-launcher-$VERSION-win-x64-portable.zip" \
"build/windows-installer/wtoffline-launcher-$VERSION-win-x64-portable.manifest.json" \
"build/windows-installer/wtoffline-launcher-$VERSION-win-x64-portable.manifest.json.sig" \
"${flags[@]}" \
--title "WTOffline Launcher $VERSION" \
--notes-file ".github/release-notes/v$VERSION.md" \
--target "$GITHUB_SHA"