Skip to content

revert: one CHANGELOG per console, no per-version files #18

revert: one CHANGELOG per console, no per-version files

revert: one CHANGELOG per console, no per-version files #18

Workflow file for this run

name: Release
# Triggered by tags shaped like <console>-v<semver>, e.g. gcn-v0.1.0,
# pce-v0.2.3, etc. The console subdir comes from the prefix; only that
# console's app is built and attached to a GitHub Release.
on:
push:
tags:
- '*-v[0-9]+.[0-9]+.[0-9]+'
- '*-v[0-9]+.[0-9]+.[0-9]+-*' # pre-release suffixes (alpha, rc, etc.)
permissions:
contents: write # needed to create the release
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
jobs:
parse:
name: Parse tag
runs-on: ubuntu-latest
outputs:
console: ${{ steps.split.outputs.console }}
version: ${{ steps.split.outputs.version }}
title: ${{ steps.split.outputs.title }}
steps:
- id: split
run: |
TAG="${GITHUB_REF_NAME}"
CONSOLE="${TAG%%-v*}"
VERSION="${TAG#*-v}"
case "$CONSOLE" in
gcn) PRETTY="GameCube" ;;
wii) PRETTY="Wii" ;;
n64) PRETTY="Nintendo 64" ;;
snes) PRETTY="Super Nintendo" ;;
gba) PRETTY="Game Boy Advance" ;;
pce) PRETTY="PC Engine" ;;
*) PRETTY="$CONSOLE" ;;
esac
echo "console=$CONSOLE" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "title=Joypad Tester — $PRETTY v$VERSION" >> "$GITHUB_OUTPUT"
build-and-release:
name: Build + release ${{ needs.parse.outputs.console }} v${{ needs.parse.outputs.version }}
needs: parse
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Verify VERSION matches tag
run: |
FILE_VER="$(cat ${{ needs.parse.outputs.console }}/VERSION | tr -d '[:space:]')"
if [ "$FILE_VER" != "${{ needs.parse.outputs.version }}" ]; then
echo "::error::${{ needs.parse.outputs.console }}/VERSION ($FILE_VER) does not match tag (${{ needs.parse.outputs.version }})"
exit 1
fi
- name: Set up Python
if: needs.parse.outputs.console == 'gcn'
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Pillow
if: needs.parse.outputs.console == 'gcn'
run: pip install --quiet Pillow
- name: Generate banner
if: needs.parse.outputs.console == 'gcn'
working-directory: ${{ needs.parse.outputs.console }}
run: python3 buildtools/make_banner.py opening.bnr
- name: Generate screensaver logo header
if: needs.parse.outputs.console == 'gcn'
working-directory: ${{ needs.parse.outputs.console }}
run: python3 buildtools/make_logo.py
- name: Build (GameCube)
if: needs.parse.outputs.console == 'gcn'
run: |
docker run --rm \
-v "${{ github.workspace }}":/workspace \
-w /workspace/${{ needs.parse.outputs.console }} \
-u "$(id -u):$(id -g)" \
ghcr.io/extremscorner/libogc2:latest \
bash -c "apt-get install -y -qq --no-install-recommends -t bookworm-backports xorriso 2>/dev/null; TARGET_CONSOLE=gamecube make && TARGET_CONSOLE=wii make"
- name: Build (GBA — both variants)
if: needs.parse.outputs.console == 'gba'
run: |
docker run --rm \
-v "${{ github.workspace }}":/workspace \
-w /workspace/gba \
-u "$(id -u):$(id -g)" \
devkitpro/devkitarm:latest \
make
- name: Build (PC Engine)
if: needs.parse.outputs.console == 'pce'
run: |
docker build -t joypad-tester-huc:release pce/buildtools/
docker run --rm \
-v "${{ github.workspace }}":/workspace \
-w /workspace/pce \
-u "$(id -u):$(id -g)" \
joypad-tester-huc:release \
make
- name: Stage release artifacts (GameCube)
if: needs.parse.outputs.console == 'gcn'
working-directory: ${{ needs.parse.outputs.console }}
run: |
# Flash-cart-friendly artifact names:
# joypad_tester_v<ver>_<platform>.dol so a user dropping the
# download onto an SD card sees the project + version inline.
# opening.bnr keeps its canonical name (required by Swiss).
VERSION="${{ needs.parse.outputs.version }}"
mkdir -p _release
[ -f joypad-tester-gamecube.dol ] && cp joypad-tester-gamecube.dol "_release/joypad_tester_v${VERSION}_gamecube.dol"
[ -f joypad-tester-wii.dol ] && cp joypad-tester-wii.dol "_release/joypad_tester_v${VERSION}_wii.dol"
[ -f opening.bnr ] && cp opening.bnr _release/
ls -la _release/
- name: Stage release artifacts (GBA)
if: needs.parse.outputs.console == 'gba'
working-directory: gba
run: |
# Public release ships only the user-facing tester ROM.
# The eyes variant (joypad_mb.gba) is a firmware payload meant
# to be multibooted by a separate host (joypad-os keeps its
# own copy for that role), not run standalone -- end-users
# downloading the release want a playable joypad tester. The
# eyes build still lives in gba/build/ for source-tree
# consumers but doesn't get a Release attachment.
# Flash-cart-friendly name: joypad_tester_v<ver>.gba.
VERSION="${{ needs.parse.outputs.version }}"
mkdir -p _release
cp build/tester/tester_mb.gba "_release/joypad_tester_v${VERSION}.gba"
ls -la _release/
- name: Stage release artifacts (PC Engine)
if: needs.parse.outputs.console == 'pce'
working-directory: pce
run: |
# Flash-cart-friendly name: joypad_tester_v<ver>.pce.
VERSION="${{ needs.parse.outputs.version }}"
mkdir -p _release
cp build/joypad-tester.pce "_release/joypad_tester_v${VERSION}.pce"
ls -la _release/
- name: Extract release body from CHANGELOG
id: notes
working-directory: ${{ needs.parse.outputs.console }}
run: |
VERSION="${{ needs.parse.outputs.version }}"
if [ -f CHANGELOG.md ]; then
awk -v ver="v$VERSION" '
/^## / {
if (capture) exit
if (index($0, ver)) capture = 1
next
}
capture { print }
' CHANGELOG.md > _notes.md
fi
if [ ! -s _notes.md ]; then
echo "Release ${{ needs.parse.outputs.title }}." > _notes.md
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: ${{ needs.parse.outputs.title }}
body_path: ${{ needs.parse.outputs.console }}/_notes.md
draft: false
prerelease: ${{ contains(github.ref_name, '-alpha') || contains(github.ref_name, '-beta') || contains(github.ref_name, '-rc') }}
files: ${{ needs.parse.outputs.console }}/_release/*