-
Notifications
You must be signed in to change notification settings - Fork 0
173 lines (154 loc) · 7.56 KB
/
Copy pathmacos-release.yml
File metadata and controls
173 lines (154 loc) · 7.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: macOS Release (Apple Silicon)
# Builds the native macOS arm64 Zero Hour engine and the SwiftUI launcher.
#
# Engine and launcher are versioned independently via tag prefixes:
# - push tag engine-vX.Y.Z -> build + package engine, publish a GitHub
# Release "engine-vX.Y.Z" with the engine zip
# - push tag launcher-vX.Y.Z -> build the launcher, publish a GitHub Release
# "launcher-vX.Y.Z" with the launcher app zip
# - manual run (workflow_dispatch) -> build artifacts only, no release
#
# A plain push/merge to a branch triggers NOTHING — releases come from tags only.
#
# Apple Silicon only (M-series). No vcpkg: the macOS build links just the
# bundled bink/miles dylibs + system frameworks (toolchain = Xcode + CMake + Ninja).
on:
push:
tags:
- 'engine-v*'
- 'launcher-v*'
workflow_dispatch:
inputs:
component:
description: "Component(s) to build (manual run never publishes a release)"
type: choice
options: [both, engine, launcher]
default: both
version:
description: "Version string to stamp for a manual build"
default: "0.0.0-dev"
permissions:
contents: write
concurrency:
group: macos-release-${{ github.ref }}
# Never cancel an in-flight tag/release build; only supersede manual runs.
cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }}
jobs:
build:
name: Build & package (arm64)
runs-on: macos-15
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0 # full history + tags for git-derived versioning
# ---- resolve component + version from the tag (or manual inputs) --------
- name: Resolve build target
id: setup
run: |
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
REF="${GITHUB_REF_NAME}"
case "$REF" in
engine-v*) COMPONENT=engine; VERSION="${REF#engine-v}" ;;
launcher-v*) COMPONENT=launcher; VERSION="${REF#launcher-v}" ;;
*) echo "::error::Unrecognised tag '$REF' (expected engine-v* or launcher-v*)"; exit 1 ;;
esac
PUBLISH=true
else
COMPONENT="${{ inputs.component }}"
VERSION="${{ inputs.version }}"
PUBLISH=false
fi
{
echo "component=${COMPONENT}"
echo "version=${VERSION}"
echo "publish=${PUBLISH}"
} >> "$GITHUB_OUTPUT"
- name: Show toolchain
run: |
cmake --version
xcodebuild -version
swift --version
# ---- engine ------------------------------------------------------------
- name: Install Ninja
if: steps.setup.outputs.component == 'engine' || steps.setup.outputs.component == 'both'
run: brew install ninja
- name: Configure engine (apple-arm64-release preset)
if: steps.setup.outputs.component == 'engine' || steps.setup.outputs.component == 'both'
# apple-arm64-release = FFmpeg OFF, so the binary links only the bundled
# bink/miles dylibs + system frameworks (see header) and runs on any Apple
# Silicon Mac without Homebrew. Trade-off: in-engine video playback is disabled.
run: cmake --preset apple-arm64-release -DRTS_VERSION=${{ steps.setup.outputs.version }}
- name: Build engine (Release)
if: steps.setup.outputs.component == 'engine' || steps.setup.outputs.component == 'both'
# CMake target is z_generals; its OUTPUT_NAME is generalszh.
run: cmake --build build/apple-arm64-release --config Release --target z_generals
- name: Package engine payload
if: steps.setup.outputs.component == 'engine' || steps.setup.outputs.component == 'both'
run: bash scripts/package-macos-release.sh Release build/apple-arm64-release
# ---- launcher ----------------------------------------------------------
- name: Build launcher app + DMG
if: steps.setup.outputs.component == 'launcher' || steps.setup.outputs.component == 'both'
env:
VERSION: ${{ steps.setup.outputs.version }}
run: |
brew install create-dmg
APP_PATH="$(bash launcher/build-app.sh | tail -n1)"
echo "Launcher: ${APP_PATH}"
# .app.zip is what the launcher's self-updater downloads; .dmg is the
# drag-to-Applications installer for first-time human installs.
( cd dist && ditto -c -k --keepParent "GeneralsZH Launcher.app" "GeneralsZH-Launcher.app.zip" )
bash launcher/make-dmg.sh "${APP_PATH}"
shasum -a 256 dist/GeneralsZH-Launcher.app.zip dist/GeneralsZH-Launcher.dmg | tee -a dist/SHA256SUMS
# ---- artifacts (always, for inspection) --------------------------------
- name: Upload artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: GeneralsZH-macOS-${{ steps.setup.outputs.component }}-${{ steps.setup.outputs.version }}
path: |
dist/GeneralsZH-macOS-arm64.zip
dist/GeneralsZH-Launcher.app.zip
dist/GeneralsZH-Launcher.dmg
dist/SHA256SUMS
if-no-files-found: warn
# ---- publish (tag pushes only) -----------------------------------------
- name: Publish engine release
if: steps.setup.outputs.publish == 'true' && steps.setup.outputs.component == 'engine'
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
run: |
gh release create "${TAG}" \
dist/GeneralsZH-macOS-arm64.zip \
dist/SHA256SUMS \
--title "Zero Hour engine — macOS (Apple Silicon) ${TAG}" \
--notes "Native macOS arm64 build of the Command & Conquer: Generals — Zero Hour engine.
The **GeneralsZH Launcher** downloads this engine automatically. You must own a
legitimate copy of Zero Hour — EA game data is **not** included.
Apple Silicon (M-series) only. Checksums in \`SHA256SUMS\`."
- name: Publish launcher release
if: steps.setup.outputs.publish == 'true' && steps.setup.outputs.component == 'launcher'
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
run: |
gh release create "${TAG}" \
dist/GeneralsZH-Launcher.dmg \
dist/GeneralsZH-Launcher.app.zip \
dist/SHA256SUMS \
--title "GeneralsZH Launcher — macOS (Apple Silicon) ${TAG}" \
--notes "Native macOS arm64 launcher for Command & Conquer: Generals — Zero Hour.
## Install
1. Download **GeneralsZH-Launcher.dmg**, open it, and drag **GeneralsZH Launcher.app**
onto the **Applications** folder.
2. The app is ad-hoc signed (not notarized), so macOS Gatekeeper blocks it on first
launch (\"damaged\" / \"can't be checked for malware\"). Clear the quarantine flag
once in Terminal, then open it normally:
\`\`\`
xattr -dr com.apple.quarantine \"/Applications/GeneralsZH Launcher.app\"
\`\`\`
3. Pick the folder with your original Zero Hour data (\`.big\` files) and press **Play**.
The engine is downloaded automatically from the latest \`engine-v*\` release.
(\`GeneralsZH-Launcher.app.zip\` is also attached — it's what the launcher's built-in
updater uses.) Apple Silicon (M-series) only. Checksums in \`SHA256SUMS\`."