Files
NX2navi/.github/workflows/linux-appimage.yml

78 lines
3.9 KiB
YAML

# The Linux AppImage of each release (tools/make_appimage.py), built on a Linux runner and attached to the release
# itself: the release is assembled on Windows (tools/make_release.py), and the AppImage needs Linux (the translator's
# NativeAOT build for linux-x64, appimagetool). It holds the build kit only, no game files, as the setup does.
name: Linux AppImage
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: 'Release tag to build the AppImage for (it replaces one already attached)'
required: true
permissions:
contents: write # gh release upload
concurrency:
group: linux-appimage-${{ github.event.release.tag_name || inputs.tag }}
jobs:
appimage:
runs-on: ubuntu-24.04
timeout-minutes: 60
env:
TAG: ${{ github.event.release.tag_name || inputs.tag }}
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name || inputs.tag }}
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- uses: astral-sh/setup-uv@v6
- name: Shader compilers
# make_appimage.py compiles the runtime's own shaders (tools/build_shaders.py: glslc, spirv-as, spirv-val)
# The runner's sources go through a mirror list whose first host (azure.archive.ubuntu.com) stopped resolving
# on 2026-11-11, and apt then failed every fetch: the sources name Ubuntu's own archive instead.
run: |
sudo sed -i 's|mirror+file:/etc/apt/apt-mirrors.txt|http://archive.ubuntu.com/ubuntu/|' \
/etc/apt/sources.list.d/*.sources /etc/apt/sources.list 2>/dev/null || true
for i in 1 2 3; do
sudo apt-get update && sudo apt-get install -y glslc spirv-tools && exit 0
echo "apt failed ($i), trying again in 30 s"; sleep 30
done
exit 1
- name: Shader translator and VMA
run: |
uv venv -q --python 3.12 .venv
uv pip install -q --python .venv/bin/python pillow
.venv/bin/python tools/build_xlate.py
.venv/bin/python -c 'import sys; sys.path.insert(0, "tools"); import build_game; print("VMA:", build_game.vma_include())'
- name: Button art from the release's app zip
run: |
# make_release.py uploads the zip with the release; wait for it if the release was published first
for i in $(seq 1 20); do
gh release download "$TAG" -p 'NX2navi-app-*.zip' -D "$RUNNER_TEMP/app" && break
echo "no app zip on $TAG yet ($i)"; sleep 30
done
unzip -q "$RUNNER_TEMP"/app/NX2navi-app-*.zip 'prompt-art/*' -d "$RUNNER_TEMP/app" || true
ls -d "$RUNNER_TEMP/app/prompt-art" 2>/dev/null || echo "::warning::no prompt-art in the app zip: the AppImage's builds keep the Switch prompts"
- name: AppImage
run: |
uv python install -q 3.14
py=$(find "$(uv python dir)" -maxdepth 1 -type d -name 'cpython-3.14.*-linux-x86_64-gnu' | sort -V | tail -1)
curl -fsSL -o "$RUNNER_TEMP/appimagetool" \
https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x "$RUNNER_TEMP/appimagetool"
art=(); [ -d "$RUNNER_TEMP/app/prompt-art" ] && art=(--prompt-art "$RUNNER_TEMP/app/prompt-art")
APPIMAGE_EXTRACT_AND_RUN=1 .venv/bin/python tools/make_appimage.py --python "$py" \
--appimagetool "$RUNNER_TEMP/appimagetool" --out dist "${art[@]}"
appimage=$(ls dist/NX2navi-Linux-*-x86_64.AppImage)
APPIMAGE_EXTRACT_AND_RUN=1 "$appimage" --help | head -3
(cd dist && sha256sum NX2navi-Linux-*-x86_64.AppImage > SHA256SUMS-linux.txt && cat SHA256SUMS-linux.txt)
- name: Attach to the release
run: gh release upload "$TAG" --clobber dist/NX2navi-Linux-*-x86_64.AppImage dist/SHA256SUMS-linux.txt