d89e27113f
nightly-build.yml builds, once a night, the newest union/<agent>-<name> branch on origin when it is newer than main and holds something main lacks (else main), and publishes it as the `nightly` pre-release; the previous one stays a week as nightly-<date> (tools/ci/nightly.py pick/rotate/prune). Launchers ignore it until a player turns Nightly on (next PR). The release builds move unchanged into game-build.yml, a reusable workflow both release.yml and the nightly call from main's copy. The nightly builds with no secrets and the macOS keychain locked; only the sign job holds the key, and it runs nothing but main's sign_release.sh over the archives, for the message "horizon release nightly". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
167 lines
7.6 KiB
YAML
167 lines
7.6 KiB
YAML
name: nightly build
|
|
# The opt-in Nightly channel (docs/release-flow.md "Nightly"; Ludovic, 2026-10-27). Once a night it builds the newest
|
|
# union branch on origin (union/<agent>-<name>: main plus pull requests the contribution gate proved together), or
|
|
# main when no union is newer, and publishes it as the `nightly` pre-release. Launchers install it only for players
|
|
# who turn Nightly on. The previous nightly stays a week as nightly-<date>.
|
|
#
|
|
# Why the signing key never meets the union's code:
|
|
# - This file, game-build.yml and every script below run from main's copy: a schedule runs the default branch, and
|
|
# `uses: ./…` takes the caller's commit. The union's own .github/ is never read.
|
|
# - `build` (game-build.yml) checks out and compiles the union with no secrets: its token reads contents only and
|
|
# isn't kept in the checkout; the macOS programs are signed ad hoc (Developer ID needs the runner's keychain,
|
|
# which stays locked for nightlies).
|
|
# - `sign` is the only job with RELEASE_SIGNING_KEY. It checks out nothing but main's tools/ci/sign_release.sh, which
|
|
# runs the runner's sha256sum and OpenSSL over the archives: it hashes them, never runs them. The signed message
|
|
# names the channel ("horizon release nightly"), so a nightly's signature can't pass for a release's.
|
|
# - `publish` verifies the signature with main's horizon-release-sign, checks the smoke test, and only then moves
|
|
# the tag. Like sign, it never executes what build produced.
|
|
# gh workflow run "nightly build" # now (skips when the pick is the same commit as last night's)
|
|
# gh workflow run "nightly build" -f force=true # build and publish even if unchanged
|
|
# gh workflow run "nightly build" -f dry_run=true # build and sign with a throwaway key, publish nothing
|
|
on:
|
|
schedule:
|
|
- cron: '17 20 * * *' # 20:17 UTC: after the day's waves, before the 03:07 Paris parity audit takes the Mac mini
|
|
workflow_dispatch:
|
|
inputs:
|
|
force:
|
|
description: Build and publish even if tonight's pick is the commit already published
|
|
type: boolean
|
|
default: false
|
|
dry_run:
|
|
description: Build and sign with a throwaway key, publish nothing
|
|
type: boolean
|
|
default: false
|
|
permissions:
|
|
contents: read
|
|
concurrency:
|
|
group: nightly-build
|
|
cancel-in-progress: false
|
|
jobs:
|
|
pick:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
outputs:
|
|
build: ${{ steps.pick.outputs.build }}
|
|
sha: ${{ steps.pick.outputs.sha }}
|
|
source: ${{ steps.pick.outputs.source }}
|
|
date: ${{ steps.pick.outputs.date }}
|
|
version: ${{ steps.pick.outputs.version }}
|
|
nightly: ${{ steps.pick.outputs.nightly }}
|
|
dry_run: ${{ steps.mode.outputs.dry_run }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
- id: mode
|
|
# A dry run never publishes; a hand-started run off main is always one.
|
|
run: echo "dry_run=${{ github.event_name == 'workflow_dispatch' && (inputs.dry_run || github.ref != 'refs/heads/main') }}" >> "$GITHUB_OUTPUT"
|
|
- id: pick
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
FORCE: ${{ (inputs.force || steps.mode.outputs.dry_run == 'true') && 'yes' || '' }}
|
|
run: |
|
|
python3 tools/ci/nightly.py pick ${FORCE:+--force} | tee -a "$GITHUB_STEP_SUMMARY"
|
|
{ echo; cat nightly-notes.md; } >> "$GITHUB_STEP_SUMMARY"
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: nightly-notes
|
|
path: nightly-notes.md
|
|
retention-days: 3
|
|
|
|
build:
|
|
needs: pick
|
|
if: needs.pick.outputs.build == 'true'
|
|
uses: ./.github/workflows/game-build.yml
|
|
with:
|
|
ref: ${{ needs.pick.outputs.sha }}
|
|
version: ${{ needs.pick.outputs.version }}
|
|
nightly: ${{ needs.pick.outputs.nightly }}
|
|
developer_id: false
|
|
|
|
sign:
|
|
needs: [pick, build]
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
# The key's only job: main's sign_release.sh hashes the archives and signs with the runner's OpenSSL.
|
|
environment: ${{ needs.pick.outputs.dry_run != 'true' && 'release' || '' }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
sparse-checkout: tools/ci/sign_release.sh
|
|
sparse-checkout-cone-mode: false
|
|
persist-credentials: false
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
path: dist
|
|
pattern: horizon-*
|
|
merge-multiple: true
|
|
- name: Sign the checksums (SHA256SUMS, SHA256SUMS.sig) for the nightly channel
|
|
env:
|
|
RELEASE_SIGNING_KEY: ${{ secrets.RELEASE_SIGNING_KEY }}
|
|
RELEASE_SIGNING_KEY_NEXT: ${{ secrets.RELEASE_SIGNING_KEY_NEXT }}
|
|
EPHEMERAL: ${{ needs.pick.outputs.dry_run == 'true' && 'yes' || '' }}
|
|
run: |
|
|
bash tools/ci/sign_release.sh nightly dist/horizon-linux-x86_64.tar.gz dist/horizon-windows-x64.zip \
|
|
dist/horizon-macos-arm64.zip dist/horizon-server-linux-x86_64.tar.gz
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: signature
|
|
path: dist/SHA256SUMS*
|
|
if-no-files-found: error
|
|
retention-days: 3
|
|
- uses: actions/upload-artifact@v4
|
|
if: needs.pick.outputs.dry_run == 'true'
|
|
with:
|
|
name: ephemeral.pub
|
|
path: dist/ephemeral.pub
|
|
retention-days: 3
|
|
|
|
publish:
|
|
needs: [pick, build, sign]
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
path: dist
|
|
merge-multiple: true
|
|
- name: The signature, checked as launchers check it
|
|
env:
|
|
EPHEMERAL: ${{ needs.pick.outputs.dry_run == 'true' && 'yes' || '' }}
|
|
run: |
|
|
key=(); [[ -n "$EPHEMERAL" ]] && key=(--key "$(cat dist/ephemeral.pub)")
|
|
cargo run --locked --quiet -p horizon-release-sign -- verify --tag nightly --publishing "${key[@]}" dist
|
|
- name: The smoke test drew a world
|
|
# No release-blocker check: a nightly is how blockers get tested.
|
|
run: python3 tools/release_train.py gate --kind game --smoke dist/smoke-test.json
|
|
- name: Publish as the `nightly` pre-release
|
|
if: needs.pick.outputs.dry_run != 'true'
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
SHA: ${{ needs.pick.outputs.sha }}
|
|
DATE: ${{ needs.pick.outputs.date }}
|
|
run: |
|
|
set -euo pipefail
|
|
python3 tools/ci/nightly.py rotate
|
|
signature=(); [[ -f dist/SHA256SUMS.sig ]] && signature=(dist/SHA256SUMS.sig)
|
|
# A pre-release, never GitHub's latest: launchers on the release channel never see it.
|
|
gh release create nightly --prerelease --latest=false --target "$SHA" \
|
|
--title "Nightly $DATE · ${SHA:0:7}" --notes-file dist/nightly-notes.md \
|
|
"dist/horizon-linux-x86_64.tar.gz#Nightly game files: Linux (horizon-linux-x86_64.tar.gz)" \
|
|
"dist/horizon-windows-x64.zip#Nightly game files: Windows (horizon-windows-x64.zip)" \
|
|
"dist/horizon-macos-arm64.zip#Nightly game files: macOS (horizon-macos-arm64.zip)" \
|
|
"dist/horizon-server-linux-x86_64.tar.gz#Nightly dedicated server for Linux (horizon-server-linux-x86_64.tar.gz)" \
|
|
dist/SHA256SUMS "${signature[@]}" dist/smoke-test.json
|
|
python3 tools/ci/nightly.py prune --days 7
|
|
- name: Dry run, the nightly that would be published
|
|
if: needs.pick.outputs.dry_run == 'true'
|
|
run: |
|
|
echo "Would publish nightly at ${{ needs.pick.outputs.sha }} (${{ needs.pick.outputs.source }})"
|
|
ls -l dist
|