Files
WoWee/.github/workflows/release.yml
2026-07-14 17:37:34 -07:00

483 lines
16 KiB
YAML

name: Release
on:
push:
tags: [ 'v*' ]
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
permissions:
contents: write
jobs:
build-linux:
name: Build (linux-${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- arch: x86-64
runner: ubuntu-24.04
- arch: arm64
runner: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: true
- name: Cache apt packages
uses: actions/cache@v4
with:
path: /var/cache/apt/archives/*.deb
key: apt-${{ matrix.arch }}-${{ hashFiles('.github/workflows/release.yml') }}
restore-keys: apt-${{ matrix.arch }}-
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
cmake \
build-essential \
pkg-config \
libsdl2-dev \
libglm-dev \
libssl-dev \
zlib1g-dev \
libvulkan-dev \
vulkan-tools \
glslc \
libavformat-dev \
libavcodec-dev \
libswscale-dev \
libavutil-dev \
libunicorn-dev \
libx11-dev
sudo apt-get install -y libstorm-dev || true
- name: Configure
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
- name: Verify Release Config
run: |
cmake -LA -N build | grep -E '^CMAKE_BUILD_TYPE:STRING=Release$'
- name: Build
run: cmake --build build --parallel $(nproc)
- name: Package
run: |
TAG="${GITHUB_REF_NAME}"
STAGING="wowee-${TAG}-linux-${{ matrix.arch }}"
mkdir -p "${STAGING}"
# Binary
cp build/bin/wowee "${STAGING}/"
# Asset extraction tool (if built — requires StormLib)
if [ -f build/bin/asset_extract ]; then
cp build/bin/asset_extract "${STAGING}/"
fi
# Extraction scripts and GUI
cp extract_assets.sh "${STAGING}/"
cp tools/asset_pipeline_gui.py "${STAGING}/"
# Assets (exclude proprietary music)
rsync -a --exclude='Original Music' build/bin/assets/ "${STAGING}/assets/"
# Data directory (git-tracked files only)
git ls-files Data/ | while read -r f; do
mkdir -p "${STAGING}/$(dirname "$f")"
cp "$f" "${STAGING}/$f"
done
tar czf "${STAGING}.tar.gz" "${STAGING}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: wowee-linux-${{ matrix.arch }}
path: wowee-*.tar.gz
if-no-files-found: error
build-macos:
name: Build (macOS arm64)
runs-on: macos-15
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: true
- name: Install dependencies
run: |
brew install cmake pkg-config sdl2 glm openssl@3 zlib ffmpeg unicorn \
stormlib vulkan-loader vulkan-headers molten-vk shaderc
- name: Configure
run: |
BREW=$(brew --prefix)
export PKG_CONFIG_PATH="$BREW/lib/pkgconfig:$(brew --prefix ffmpeg)/lib/pkgconfig:$(brew --prefix openssl@3)/lib/pkgconfig:$(brew --prefix vulkan-loader)/lib/pkgconfig:$(brew --prefix shaderc)/lib/pkgconfig"
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_DEPLOYMENT_TARGET=13.0 \
-DCMAKE_PREFIX_PATH="$BREW" \
-DOPENSSL_ROOT_DIR="$(brew --prefix openssl@3)"
- name: Verify Release Config
run: |
cmake -LA -N build | grep -E '^CMAKE_BUILD_TYPE:STRING=Release$'
- name: Build
run: cmake --build build --parallel $(sysctl -n hw.logicalcpu)
- name: Configure Developer ID signing
env:
APPLE_CERT_P12: ${{ secrets.APPLE_DEVELOPER_ID_CERT_P12_BASE64 }}
APPLE_CERT_PASSWORD: ${{ secrets.APPLE_DEVELOPER_ID_CERT_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_DEVELOPER_ID_IDENTITY }}
run: |
if [ -z "${APPLE_CERT_P12}" ] || [ -z "${APPLE_CERT_PASSWORD}" ] || \
[ -z "${APPLE_SIGNING_IDENTITY}" ]; then
echo "MACOS_SIGNING_ENABLED=false" >> "${GITHUB_ENV}"
echo "::warning::Apple Developer ID secrets are absent; using ad-hoc signing."
exit 0
fi
KEYCHAIN_PATH="${RUNNER_TEMP}/wowee-signing.keychain-db"
KEYCHAIN_PASSWORD="$(openssl rand -base64 32)"
printf '%s' "${APPLE_CERT_P12}" | base64 -D \
> "${RUNNER_TEMP}/developer-id.p12"
security create-keychain -p "${KEYCHAIN_PASSWORD}" "${KEYCHAIN_PATH}"
security set-keychain-settings -lut 21600 "${KEYCHAIN_PATH}"
security unlock-keychain -p "${KEYCHAIN_PASSWORD}" "${KEYCHAIN_PATH}"
security import "${RUNNER_TEMP}/developer-id.p12" \
-k "${KEYCHAIN_PATH}" -P "${APPLE_CERT_PASSWORD}" -A -t cert -f pkcs12
security set-key-partition-list -S apple-tool:,apple: -s \
-k "${KEYCHAIN_PASSWORD}" "${KEYCHAIN_PATH}"
security list-keychain -d user -s "${KEYCHAIN_PATH}"
echo "MACOS_SIGNING_ENABLED=true" >> "${GITHUB_ENV}"
echo "APPLE_SIGNING_IDENTITY=${APPLE_SIGNING_IDENTITY}" >> "${GITHUB_ENV}"
- name: Create .app bundle
run: |
TAG="${GITHUB_REF_NAME}"
VERSION="${TAG#v}"
VERSION="${VERSION%%-*}"
mkdir -p Wowee.app/Contents/{MacOS,Frameworks,Resources}
bash tools/macos/create_icns.sh assets/Wowee.png \
Wowee.app/Contents/Resources/Wowee.icns
# Actual binary
cp build/bin/wowee Wowee.app/Contents/MacOS/wowee_bin
# Asset extraction is a required part of the macOS distribution.
test -x build/bin/asset_extract
cp build/bin/asset_extract Wowee.app/Contents/MacOS/
# Extraction scripts and GUI
cp extract_assets.sh Wowee.app/Contents/MacOS/
cp tools/asset_pipeline_gui.py Wowee.app/Contents/MacOS/
# Assets (exclude proprietary music)
rsync -a --exclude='Original Music' build/bin/assets/ \
Wowee.app/Contents/MacOS/assets/
# Data directory (git-tracked files only)
git ls-files Data/ | while read -r f; do
mkdir -p "Wowee.app/Contents/MacOS/$(dirname "$f")"
cp "$f" "Wowee.app/Contents/MacOS/$f"
done
# The Vulkan loader is not a graphics driver. Bundle MoltenVK and its
# ICD manifest so the app works on a clean Mac without Homebrew or the
# LunarG SDK installed.
MOLTENVK_PREFIX="$(brew --prefix molten-vk)"
cp -L "${MOLTENVK_PREFIX}/lib/libMoltenVK.dylib" \
Wowee.app/Contents/Frameworks/libMoltenVK.dylib
mkdir -p Wowee.app/Contents/Resources/vulkan/icd.d
python3 - \
"${MOLTENVK_PREFIX}/etc/vulkan/icd.d/MoltenVK_icd.json" \
Wowee.app/Contents/Resources/vulkan/icd.d/MoltenVK_icd.json <<'PY'
import json
import pathlib
import sys
source, destination = map(pathlib.Path, sys.argv[1:])
manifest = json.loads(source.read_text(encoding="utf-8"))
manifest["ICD"]["library_path"] = "../../../Frameworks/libMoltenVK.dylib"
manifest["ICD"]["is_portability_driver"] = True
destination.write_text(json.dumps(manifest, indent=2) + "\n", encoding="utf-8")
PY
# Traverse every non-system dependency from the original Mach-O files,
# copy only the referenced install names, and rewrite the whole graph.
BUNDLE_ROOTS=(Wowee.app/Contents/MacOS/wowee_bin)
if [ -f Wowee.app/Contents/MacOS/asset_extract ]; then
BUNDLE_ROOTS+=(Wowee.app/Contents/MacOS/asset_extract)
fi
BUNDLE_ROOTS+=(Wowee.app/Contents/Frameworks/libMoltenVK.dylib)
python3 tools/macos/bundle_dependencies.py \
--app Wowee.app \
--search-dir "$(brew --prefix sdl2)/lib" \
--search-dir "$(brew --prefix vulkan-loader)/lib" \
--search-dir "$(brew --prefix openssl@3)/lib" \
--search-dir "$(brew --prefix ffmpeg)/lib" \
--search-dir "$(brew --prefix unicorn)/lib" \
--search-dir "$(brew --prefix stormlib)/lib" \
--search-dir "$(brew --prefix glm)/lib" \
"${BUNDLE_ROOTS[@]}"
# Info.plist
cat > Wowee.app/Contents/Info.plist << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
<key>CFBundleExecutable</key><string>wowee_bin</string>
<key>CFBundleIdentifier</key><string>com.wowee.app</string>
<key>CFBundleName</key><string>Wowee</string>
<key>CFBundleIconFile</key><string>Wowee</string>
<key>CFBundleVersion</key><string>${GITHUB_RUN_NUMBER}</string>
<key>CFBundleShortVersionString</key><string>${VERSION}</string>
<key>CFBundlePackageType</key><string>APPL</string>
<key>LSMinimumSystemVersion</key><string>13.0</string>
</dict></plist>
EOF
# Build a visible, independently signed extraction launcher.
bash tools/macos/create_asset_extractor_app.sh \
"Wowee Asset Extractor.app" "${VERSION}" \
Wowee.app/Contents/Resources/Wowee.icns
IDENTITY="-"
if [ "${MACOS_SIGNING_ENABLED}" = "true" ]; then
IDENTITY="${APPLE_SIGNING_IDENTITY}"
fi
bash tools/macos/sign_app.sh Wowee.app "${IDENTITY}"
bash tools/macos/sign_app.sh "Wowee Asset Extractor.app" "${IDENTITY}"
- name: Verify bundled dylibs
run: |
bash tools/macos/verify_bundle.sh Wowee.app arm64
codesign --verify --deep --strict --verbose=2 "Wowee Asset Extractor.app"
- name: Create DMG
run: |
TAG="${GITHUB_REF_NAME}"
rm -rf dmg-root
mkdir dmg-root
mv Wowee.app dmg-root/
mv "Wowee Asset Extractor.app" dmg-root/
cp tools/macos/ASSET_EXTRACTION_README.txt \
"dmg-root/README - Asset Extraction.txt"
ln -s /Applications dmg-root/Applications
hdiutil create -volname Wowee -srcfolder dmg-root -ov -format UDZO \
"wowee-${TAG}-macos-arm64.dmg"
- name: Notarize and staple DMG
env:
APPLE_NOTARY_KEY: ${{ secrets.APPLE_NOTARY_KEY_P8_BASE64 }}
APPLE_NOTARY_KEY_ID: ${{ secrets.APPLE_NOTARY_KEY_ID }}
APPLE_NOTARY_ISSUER_ID: ${{ secrets.APPLE_NOTARY_ISSUER_ID }}
run: |
if [ "${MACOS_SIGNING_ENABLED}" != "true" ] || \
[ -z "${APPLE_NOTARY_KEY}" ] || [ -z "${APPLE_NOTARY_KEY_ID}" ] || \
[ -z "${APPLE_NOTARY_ISSUER_ID}" ]; then
echo "::warning::Notarization credentials are absent; DMG cannot be stapled."
exit 0
fi
DMG="wowee-${GITHUB_REF_NAME}-macos-arm64.dmg"
printf '%s' "${APPLE_NOTARY_KEY}" | base64 -D \
> "${RUNNER_TEMP}/AuthKey.p8"
xcrun notarytool submit "${DMG}" \
--key "${RUNNER_TEMP}/AuthKey.p8" \
--key-id "${APPLE_NOTARY_KEY_ID}" \
--issuer "${APPLE_NOTARY_ISSUER_ID}" \
--wait --timeout 30m
xcrun stapler staple "${DMG}"
xcrun stapler validate "${DMG}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: wowee-macos-arm64
path: wowee-*.dmg
if-no-files-found: error
build-windows:
name: Build (windows-${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- arch: x86-64
runner: windows-latest
msystem: MINGW64
prefix: mingw-w64-x86_64
- arch: arm64
runner: windows-11-arm
msystem: CLANGARM64
prefix: mingw-w64-clang-aarch64
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: true
- name: Set up MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
update: ${{ matrix.arch == 'arm64' }}
# Disable the install cache: a restored cache carries a stale pacman DB
# whose signatures the older cached keyring rejects ("unknown trust"),
# breaking setup after MSYS2 rotates signing keys.
cache: false
- name: Install dependencies with mirror retry
shell: msys2 {0}
env:
PREFIX: ${{ matrix.prefix }}
COMPILER_PACKAGE: ${{ matrix.arch == 'x86-64' && format('{0}-gcc', matrix.prefix) || format('{0}-clang', matrix.prefix) }}
run: |
packages=(
"${PREFIX}-cmake" "${COMPILER_PACKAGE}" "${PREFIX}-ninja"
"${PREFIX}-pkgconf" "${PREFIX}-SDL2" "${PREFIX}-glm"
"${PREFIX}-openssl" "${PREFIX}-zlib" "${PREFIX}-ffmpeg"
"${PREFIX}-unicorn" "${PREFIX}-vulkan-loader"
"${PREFIX}-vulkan-headers" "${PREFIX}-shaderc"
"${PREFIX}-libtommath" "${PREFIX}-libtomcrypt" git zip
)
for attempt in 1 2 3; do
if pacman -S --noconfirm --needed "${packages[@]}"; then
exit 0
fi
echo "MSYS2 package download failed on attempt ${attempt}; retrying..."
sleep $((attempt * 10))
done
exit 1
- name: Build StormLib from source
shell: msys2 {0}
run: |
git clone --depth 1 https://github.com/ladislav-zezula/StormLib.git /tmp/StormLib
# Disable x86 inline asm in bundled libtomcrypt (bswapl/movl) —
# __MINGW32__ is defined on CLANGARM64 which incorrectly enables x86 asm
cmake -S /tmp/StormLib -B /tmp/StormLib/build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$MINGW_PREFIX" \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-DLTC_NO_BSWAP" \
-DCMAKE_CXX_FLAGS="-DLTC_NO_BSWAP"
cmake --build /tmp/StormLib/build --parallel $(nproc)
cmake --install /tmp/StormLib/build
- name: Configure
shell: msys2 {0}
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
- name: Verify Release Config
shell: msys2 {0}
run: |
cmake -LA -N build | grep -E '^CMAKE_BUILD_TYPE:STRING=Release$'
- name: Build
shell: msys2 {0}
run: cmake --build build --parallel $(nproc)
- name: Bundle DLLs
shell: msys2 {0}
run: |
for exe in build/bin/wowee.exe build/bin/asset_extract.exe; do
[ -f "$exe" ] || continue
ldd "$exe" \
| awk '/=> \// { print $3 }' \
| grep -iv '^/c/Windows' \
| xargs -I{} sh -c 'cp -n "{}" build/bin/ 2>/dev/null || true'
done
- name: Package
shell: msys2 {0}
run: |
TAG="${GITHUB_REF_NAME}"
STAGING="wowee-${TAG}-windows-${{ matrix.arch }}"
mkdir -p "${STAGING}"
# Binary and DLLs
cp build/bin/wowee.exe "${STAGING}/"
cp build/bin/*.dll "${STAGING}/" 2>/dev/null || true
# Asset extraction tool (if built — requires StormLib)
if [ -f build/bin/asset_extract.exe ]; then
cp build/bin/asset_extract.exe "${STAGING}/"
fi
# Extraction scripts and GUI
cp extract_assets.ps1 "${STAGING}/"
cp extract_assets.bat "${STAGING}/"
cp tools/asset_pipeline_gui.py "${STAGING}/"
# Assets (exclude proprietary music)
mkdir -p "${STAGING}/assets"
for d in build/bin/assets/*/; do
dirname="$(basename "$d")"
[ "$dirname" = "Original Music" ] && continue
cp -r "$d" "${STAGING}/assets/"
done
# Copy top-level asset files
cp build/bin/assets/* "${STAGING}/assets/" 2>/dev/null || true
# Data directory (git-tracked files only)
git ls-files Data/ | while read -r f; do
mkdir -p "${STAGING}/$(dirname "$f")"
cp "$f" "${STAGING}/$f"
done
# Create ZIP
zip -r "${STAGING}.zip" "${STAGING}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: wowee-windows-${{ matrix.arch }}
path: wowee-*.zip
if-no-files-found: error
release:
name: Create Release
needs: [ build-linux, build-macos, build-windows ]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
TAG="${GITHUB_REF_NAME}"
# Collect all release files
FILES=()
for f in artifacts/*/*; do
FILES+=("$f")
done
gh release create "${TAG}" \
--title "Wowee ${TAG}" \
--generate-notes \
"${FILES[@]}"