Compare commits

..

15 commits

9 changed files with 344 additions and 125 deletions

View file

@ -40,6 +40,19 @@ env:
ALCHEMIST_PATH: .alchemist
ALCHEMIST_DIR: .alchemist/automation-tools/alchemist
# ---------------------------------------------------------------------------
# RetroVERSE item images. Artwork is center-cropped to a square at both sizes: the
# thumbnail for the client's lists and a larger copy for its details screen.
# Screenshots are shrunk to fit within the maximum size, never enlarged or
# cropped, and shipped as one archive per item that the client fetches on
# demand. Every image is converted to PNG.
# ---------------------------------------------------------------------------
ARTWORK_THUMB_SIZE: 64
ARTWORK_LARGE_SIZE: 192
SCREENSHOT_MAX_WIDTH: 1280
SCREENSHOT_MAX_HEIGHT: 720
SCREENSHOT_MAX_COUNT: 5
jobs:
# ===========================================================================
# Check whether this event should trigger a build
@ -286,7 +299,8 @@ jobs:
if [[ ! -f "$cm" ]]; then
fail "class 'component' has no component_manifest.json"
else
cm_version=$(jq -r '.version // empty' "$cm")
# Component manifests are keyed by component name: { "<id>": { "component_version": ... } }
cm_version=$(jq -r --arg id "$id" '.[$id].component_version // empty' "$cm")
if [[ "$cm_version" != "$version" ]]; then
fail "version mismatch: retroverse_manifest.json '$version' vs component_manifest.json '$cm_version'"
fi
@ -320,6 +334,39 @@ jobs:
*) fail "unparseable requirement '$req'" ;;
esac
done < <(jq -r '.requires // [] | .[]' "$manifest")
# Images are paths inside the item folder. Whether each one is a
# readable image is checked when it is converted in build-items.
check_image_path() {
local field="$1" path="$2"
if [[ "$path" == /* || "/$path/" == */../* ]]; then
fail "$field '$path' must be a relative path inside the item folder"
elif [[ ! -f "$item_dir/$path" ]]; then
fail "$field '$path' not found in $item_dir"
fi
}
if ! jq -e '(.artwork // "") | type == "string"' "$manifest" > /dev/null; then
fail "'artwork' must be a single path"
else
artwork=$(jq -r '.artwork // empty' "$manifest")
[[ -n "$artwork" ]] && check_image_path "artwork" "$artwork"
fi
if ! jq -e '(.screenshots // []) | type == "array" and all(.[]; type == "string")' "$manifest" > /dev/null; then
fail "'screenshots' must be an array of paths"
else
screenshot_count=$(jq '.screenshots // [] | length' "$manifest")
if [[ "$screenshot_count" -gt "$SCREENSHOT_MAX_COUNT" ]]; then
fail "$screenshot_count screenshots declared, the maximum is $SCREENSHOT_MAX_COUNT"
fi
if [[ "$(jq '.screenshots // [] | length != (unique | length)' "$manifest")" == "true" ]]; then
fail "the same screenshot is listed more than once"
fi
while IFS= read -r screenshot; do
check_image_path "screenshot" "$screenshot"
done < <(jq -r '.screenshots // [] | .[]' "$manifest")
fi
done
if [[ "$ITEMS" -eq 0 ]]; then
@ -435,8 +482,10 @@ jobs:
echo "Looking for previous release on branch: ${BRANCH_NAME}"
PREV_RELEASE=$(gh release list --limit 100 --json tagName \
-q "[.[] | select(.tagName | startswith(\"${BRANCH_NAME}-\"))] | .[0].tagName")
# Newest published, non-draft release for this branch. Sorted by publishedAt:
# createdAt is unreliable after bulk migrations.
PREV_RELEASE=$(gh release list --limit 100 --json tagName,publishedAt,isDraft \
-q "[.[] | select((.isDraft | not) and (.tagName | startswith(\"${BRANCH_NAME}-\")))] | sort_by(.publishedAt) | last | .tagName")
if [[ -z "$PREV_RELEASE" || "$PREV_RELEASE" == "null" ]]; then
echo "No previous release found for branch ${BRANCH_NAME}"
@ -795,13 +844,13 @@ jobs:
apt)
sudo add-apt-repository -y ppa:flatpak/stable
sudo apt update
sudo apt install -y flatpak flatpak-builder p7zip-full xmlstarlet bzip2 curl jq unzip
sudo apt install -y flatpak flatpak-builder p7zip-full xmlstarlet bzip2 curl jq unzip imagemagick
;;
pacman)
sudo pacman -Sy --noconfirm flatpak flatpak-builder p7zip xmlstarlet bzip2 curl jq unzip
sudo pacman -Sy --noconfirm flatpak flatpak-builder p7zip xmlstarlet bzip2 curl jq unzip imagemagick
;;
dnf)
sudo dnf install -y flatpak flatpak-builder p7zip p7zip-plugins xmlstarlet bzip2 curl jq unzip
sudo dnf install -y flatpak flatpak-builder p7zip p7zip-plugins xmlstarlet bzip2 curl jq unzip ImageMagick
;;
*)
echo "ERROR: No supported package manager found (apt, pacman, dnf)"
@ -822,8 +871,10 @@ jobs:
echo "Reusing $ITEM from previous release"
PREV_RELEASE=$(gh release list --limit 100 --json tagName \
-q "[.[] | select(.tagName | startswith(\"${BRANCH_NAME}-\"))] | .[0].tagName")
# Newest published, non-draft release for this branch. Sorted by publishedAt:
# createdAt is unreliable after bulk migrations.
PREV_RELEASE=$(gh release list --limit 100 --json tagName,publishedAt,isDraft \
-q "[.[] | select((.isDraft | not) and (.tagName | startswith(\"${BRANCH_NAME}-\")))] | sort_by(.publishedAt) | last | .tagName")
if [[ -z "$PREV_RELEASE" || "$PREV_RELEASE" == "null" ]]; then
echo "ERROR: No previous release found but can_reuse is true"
@ -1000,40 +1051,127 @@ jobs:
echo "Artifacts verified ($ARCHIVE_SIZE)"
# ---------------------------------------------------------------------
# Artwork is staged as a single item-named file rather than an artwork/
# directory, so collection in create-release cannot collide no matter how
# download-artifact lays the tree out. It runs for reused items too:
# artwork sits outside the fingerprint and is republished every release.
# The dependency step above only runs for items being built, but images
# are processed for every item, reused or not. Install ImageMagick here
# only if it is still missing.
# ---------------------------------------------------------------------
- name: Stage artwork
- name: Install image tools
run: |
ITEM="${{ matrix.item }}"
MANIFEST="${{ matrix.dir }}/retroverse_manifest.json"
ART_REL=$(jq -r '.artwork // empty' "$MANIFEST")
if [[ -z "$ART_REL" ]]; then
echo "No artwork declared for $ITEM"
if command -v magick &> /dev/null || command -v convert &> /dev/null; then
echo "ImageMagick already available"
exit 0
fi
ART_SRC="${{ matrix.dir }}/$ART_REL"
unset pkg_mgr
for candidate in apt pacman dnf; do
command -v "$candidate" &> /dev/null && pkg_mgr="$candidate" && break
done
case "${pkg_mgr:-}" in
apt)
sudo apt update
sudo apt install -y imagemagick
;;
pacman)
sudo pacman -Sy --noconfirm imagemagick
;;
dnf)
sudo dnf install -y ImageMagick
;;
*)
echo "ERROR: No supported package manager found (apt, pacman, dnf)"
exit 1
;;
esac
echo "ImageMagick installed"
# ---------------------------------------------------------------------
# Images are staged as item-named files rather than directories, so
# collection in create-release cannot collide no matter how
# download-artifact lays the tree out. This runs for reused items too:
# images sit outside the fingerprint and are republished every release.
#
# <item>.artwork.png thumbnail, square, ARTWORK_THUMB_SIZE
# <item>.artwork-large.png details image, square, ARTWORK_LARGE_SIZE
# <item>.screenshots.tar.gz <item>.screenshot.<n>.png, in manifest order
#
# PNGs are written without timestamps and the screenshot archive is
# built deterministically, so its sha256 only changes when a screenshot
# does. The client caches screenshots by that hash. The archive gets no
# .sha asset: its hash is published in retroverse.json, and GitHub caps a
# release at 1000 assets.
# ---------------------------------------------------------------------
- name: Stage artwork and screenshots
run: |
ITEM="${{ matrix.item }}"
ITEM_DIR="${{ matrix.dir }}"
MANIFEST="$ITEM_DIR/retroverse_manifest.json"
OUT_DIR="$ITEM/artifacts"
mkdir -p "$OUT_DIR"
if command -v magick &> /dev/null; then
IM=(magick)
else
IM=(convert)
fi
# Square center crop. Smaller sources are scaled up to fill the square.
make_square() {
local src="$1" size="$2" out="$3"
"${IM[@]}" "${src}[0]" -auto-orient -background none \
-resize "${size}x${size}^" -gravity center -extent "${size}x${size}" \
-strip -define png:exclude-chunks=date,time "PNG32:$out"
}
ART_REL=$(jq -r '.artwork // empty' "$MANIFEST")
if [[ -n "$ART_REL" ]]; then
ART_SRC="$ITEM_DIR/$ART_REL"
if [[ ! -f "$ART_SRC" ]]; then
echo "ERROR: artwork declared as '$ART_REL' but not found at $ART_SRC"
exit 1
fi
EXT="${ART_SRC##*.}"
if [[ "$EXT" == "$ART_SRC" ]]; then
echo "ERROR: artwork '$ART_REL' has no file extension"
if ! make_square "$ART_SRC" "$ARTWORK_THUMB_SIZE" "$OUT_DIR/$ITEM.artwork.png" \
|| ! make_square "$ART_SRC" "$ARTWORK_LARGE_SIZE" "$OUT_DIR/$ITEM.artwork-large.png"; then
echo "ERROR: artwork '$ART_REL' could not be converted; it may be corrupt or in an unsupported format"
exit 1
fi
echo "Artwork staged: ${ARTWORK_THUMB_SIZE}px thumbnail, ${ARTWORK_LARGE_SIZE}px details image"
else
echo "No artwork declared for $ITEM"
fi
mkdir -p "$ITEM/artifacts"
cp "$ART_SRC" "$ITEM/artifacts/$ITEM.artwork.$EXT"
mapfile -t SCREENSHOTS < <(jq -r '.screenshots // [] | .[]' "$MANIFEST")
if [[ "${#SCREENSHOTS[@]}" -eq 0 ]]; then
echo "No screenshots declared for $ITEM"
exit 0
fi
echo "Artwork staged as $ITEM.artwork.$EXT"
SHOT_DIR=$(mktemp -d)
chmod 755 "$SHOT_DIR"
n=0
for shot_rel in "${SCREENSHOTS[@]}"; do
n=$((n + 1))
shot_src="$ITEM_DIR/$shot_rel"
if [[ ! -f "$shot_src" ]]; then
echo "ERROR: screenshot '$shot_rel' not found at $shot_src"
exit 1
fi
# ">" only ever shrinks: smaller screenshots keep their size
if ! "${IM[@]}" "${shot_src}[0]" -auto-orient \
-resize "${SCREENSHOT_MAX_WIDTH}x${SCREENSHOT_MAX_HEIGHT}>" \
-strip -define png:exclude-chunks=date,time "PNG:$SHOT_DIR/$ITEM.screenshot.$n.png"; then
echo "ERROR: screenshot '$shot_rel' could not be converted; it may be corrupt or in an unsupported format"
exit 1
fi
done
tar --sort=name --mtime='@0' --owner=0 --group=0 --numeric-owner \
-cf - -C "$SHOT_DIR" . | gzip -n -9 > "$OUT_DIR/$ITEM.screenshots.tar.gz"
rm -rf "$SHOT_DIR"
echo "Screenshots staged: $n image(s), $(du -h "$OUT_DIR/$ITEM.screenshots.tar.gz" | cut -f1)"
- name: Upload artifacts
uses: actions/upload-artifact@v7
@ -1048,7 +1186,7 @@ jobs:
# ===========================================================================
create-release:
name: Create Release
needs: [configure, collect-metadata, build-items]
needs: [configure, collect-metadata, setup-matrix, build-items]
if: needs.configure.outputs.is_dry_run == 'false'
runs-on: ubuntu-latest
env:
@ -1131,7 +1269,7 @@ jobs:
while IFS= read -r art; do
cp "$art" artwork-staging/
done < <(find downloaded-artifacts/ -type f -name '*.artwork.*')
done < <(find downloaded-artifacts/ -type f \( -name '*.artwork.*' -o -name '*.artwork-large.*' \))
# Item archives only. The artwork bundle is also a .tar.gz and is
# built later in this job; excluding it by name keeps the inventory
@ -1139,6 +1277,7 @@ jobs:
ARCHIVES=()
for candidate in release-assets/*.tar.gz; do
[[ "$(basename "$candidate")" == "artwork.tar.gz" ]] && continue
[[ "$candidate" == *.screenshots.tar.gz ]] && continue
ARCHIVES+=("$candidate")
done
@ -1231,6 +1370,7 @@ jobs:
env:
CURRENT: ${{ needs.collect-metadata.outputs.items-json }}
PREV: ${{ needs.collect-metadata.outputs.prev-json }}
BUILD_MATRIX: ${{ needs.setup-matrix.outputs.build-matrix }}
run: |
RELEASE_TAG="${{ steps.tag.outputs.tag }}"
BUILD_TIMESTAMP="${{ steps.tag.outputs.timestamp }}"
@ -1250,12 +1390,13 @@ jobs:
cur_fp=$(jq -r --arg i "$item" '.[$i].fingerprint' <<< "$CURRENT")
cur_up=$(jq -r --arg i "$item" '.[$i].upstream_version // ""' <<< "$CURRENT")
cur_ver=$(jq -r --arg i "$item" '.[$i].version' <<< "$CURRENT")
prev_fp=$(jq -r --arg i "$item" '.[$i].fingerprint // empty' <<< "$PREV")
prev_ver=$(jq -r --arg i "$item" '.[$i].version // empty' <<< "$PREV")
# Reuse is decided once, in setup-matrix. Deriving it again here
# would call an item rebuilt for an Alchemist change "reused" and
# carry forward hashes that describe the previous artifact.
can_reuse=$(jq -r --arg i "$item" 'first(.[] | select(.item == $i) | .can_reuse) // false' <<< "$BUILD_MATRIX")
if [[ -n "$prev_fp" && "$cur_fp" == "$prev_fp" && "$cur_ver" == "$prev_ver" ]]; then
if [[ "$can_reuse" == "true" ]]; then
status="reused"
built_on=$(jq -r --arg i "$item" '.[$i].built_on // empty' <<< "$PREV")
file_hashes=$(jq -c --arg i "$item" '.[$i].file_hashes // {}' <<< "$PREV")
@ -1283,15 +1424,29 @@ jobs:
exit 1
fi
# The authored 'artwork' value is a repo path the client cannot see.
# Replace it with the file's name inside artwork.tar.gz, or null
# when the item ships none.
# The authored 'artwork' and 'screenshots' values are repo paths the
# client cannot see. Replace them with the names of the processed
# files: artwork inside artwork.tar.gz, screenshots inside the item's
# screenshot archive. Absent images publish as null or [].
artwork_file=""
for candidate in artwork-staging/"$item".artwork.*; do
[[ -f "$candidate" ]] || continue
artwork_file=$(basename "$candidate")
break
done
artwork_large_file=""
[[ -f "artwork-staging/$item.artwork.png" ]] && artwork_file="$item.artwork.png"
[[ -f "artwork-staging/$item.artwork-large.png" ]] && artwork_large_file="$item.artwork-large.png"
screenshots='{"screenshots": [], "screenshots_url": null, "screenshots_sha256": null, "screenshots_size": null}'
shot_archive="release-assets/$item.screenshots.tar.gz"
if [[ -f "$shot_archive" ]]; then
screenshots=$(tar -tzf "$shot_archive" | sed 's#^\./##' | grep -v '^$' | sort -V | jq -R -s -c \
--arg url "${BASE_URL}/$item.screenshots.tar.gz" \
--arg sha "$(sha256sum "$shot_archive" | awk '{print $1}')" \
--argjson size "$(stat -c%s "$shot_archive")" '
{
screenshots: (split("\n") | map(select(length > 0))),
screenshots_url: $url,
screenshots_sha256: $sha,
screenshots_size: $size
}')
fi
entry=$(jq -c \
--arg sha "$sha" \
@ -1303,6 +1458,8 @@ jobs:
--arg status "$status" \
--arg source_id "$SOURCE_ID" \
--arg artwork "$artwork_file" \
--arg artwork_large "$artwork_large_file" \
--argjson screenshots "$screenshots" \
--argjson file_hashes "$file_hashes" \
'. + {
source_id: $source_id,
@ -1314,8 +1471,9 @@ jobs:
built_on: $built_on,
status: $status,
artwork: (if $artwork == "" then null else $artwork end),
artwork_large: (if $artwork_large == "" then null else $artwork_large end),
file_hashes: $file_hashes
}' <<< "$manifest")
} + $screenshots' <<< "$manifest")
entries=$(jq -c --argjson e "$entry" '. += [$e]' <<< "$entries")
done < <(jq -r 'keys[]' <<< "$CURRENT")

View file

@ -8,7 +8,7 @@
"assets": [
{
"type": "file",
"source": "doom-shareware/DOOM1.WAD",
"source": "DOOM1.WAD",
"dest": "$COMPONENT_ARTIFACT_ROOT"
},
{

View file

@ -17,7 +17,37 @@
"files": [
{
"source": "DOOM1.WAD",
"destination": "$roms_folder/doom/DOOM1.WAD",
"destination": "$roms_path/doom/DOOM1.WAD",
"policy": "replace"
},
{
"source": "docs/DMFAQ66A.TXT",
"destination": "$roms_path/doom/doom_shareware_docs/DMFAQ66A.TXT",
"policy": "replace"
},
{
"source": "docs/DMFAQ66B.TXT",
"destination": "$roms_path/doom/doom_shareware_docs/DMFAQ66B.TXT",
"policy": "replace"
},
{
"source": "docs/DMFAQ66C.TXT",
"destination": "$roms_path/doom/doom_shareware_docs/DMFAQ66C.TXT",
"policy": "replace"
},
{
"source": "docs/DMFAQ66D.TXT",
"destination": "$roms_path/doom/doom_shareware_docs/DMFAQ66D.TXT",
"policy": "replace"
},
{
"source": "docs/HELPME.TXT",
"destination": "$roms_path/doom/doom_shareware_docs/HELPME.TXT",
"policy": "replace"
},
{
"source": "docs/README.TXT",
"destination": "$roms_path/doom/doom_shareware_docs/README.TXT",
"policy": "replace"
}
]

View file

@ -17,17 +17,32 @@
"files": [
{
"source": "freedm.wad",
"destination": "$roms_folder/doom/freedm.wad",
"destination": "$roms_path/doom/freedm.wad",
"policy": "replace"
},
{
"source": "freedoom1.wad",
"destination": "$roms_folder/doom/freedoom1.wad",
"destination": "$roms_path/doom/freedoom1.wad",
"policy": "replace"
},
{
"source": "freedoom2.wad",
"destination": "$roms_folder/doom/freedoom2.wad",
"destination": "$roms_path/doom/freedoom2.wad",
"policy": "replace"
},
{
"source": "docs/COPYING.txt",
"destination": "$roms_path/doom/freedoom_docs/COPYING.txt",
"policy": "replace"
},
{
"source": "docs/CREDITS.txt",
"destination": "$roms_path/doom/freedoom_docs/CREDITS.txt",
"policy": "replace"
},
{
"source": "docs/CREDITS-MUSIC.txt",
"destination": "$roms_path/doom/freedoom_docs/CREDITS-MUSIC.txt",
"policy": "replace"
}
]

View file

@ -0,0 +1,58 @@
{
"rtdink": {
"name": "RTDink",
"core_framework_compatibility": "1",
"component_version": "1.0.0",
"capabilities": [
"reset",
"open"
],
"url_rdwiki": "https://retrodeck.readthedocs.io/en/latest/wiki_retroverse/engines/rtdink/rtdink-guide/",
"url_webpage": "https://www.dinknetwork.com/",
"url_donation_purchase": "https://www.gog.com/en/game/dink_smallwood_hd",
"url_source": "https://github.com/SethRobinson/RTDink",
"component_type": "Engine",
"description": "RTDink Engine for Dink Smallwood HD and dmods.",
"system_friendly_name": "Dink Smallwood HD",
"system": "dink",
"artwork": "artwork/thumb.png",
"tags": [
"engine",
"game"
],
"es_de_config": {
"es_find_rules": {
"emulators": [
{
"name": "RTDINK",
"description": "RTDink - Dink Smallwood HD Engine",
"rules": [
{
"type": "staticpath",
"entries": [
"%COMPONENT_PATH%/component_launcher.sh"
]
}
]
}
]
},
"es_systems": [
{
"name": "dink",
"fullname": "Dink Smallwood HD",
"path": "%ROMPATH%/dink",
"extension": ".dink",
"commands": [
{
"label": "RTDink (Standalone)",
"command": "%EMULATOR_RTDINK% %ROM%"
}
],
"platform": "pc, pcwindows",
"theme": "dink"
}
]
}
}
}

View file

@ -18,7 +18,7 @@
},
{
"type": "file",
"source": "$REPO_ROOT/$COMPONENT_NAME/retroverse_manifest.json",
"source": "$REPO_ROOT/$COMPONENT_NAME/component_manifest.json",
"dest": "$COMPONENT_ARTIFACT_ROOT"
},
{

View file

@ -1,62 +1,15 @@
{
"rtdink": {
"name": "RTDink",
"core_framework_compatibility": "1",
"component_version": "1.0.0",
"schema_version": "1",
"min_client_schema": "1",
"id": "rtdink",
"class": "component",
"capabilities": [
"reset",
"open"
],
"url_rdwiki": "https://retrodeck.readthedocs.io/en/latest/wiki_retroverse/engines/rtdink/rtdink-guide/",
"url_webpage": "https://www.dinknetwork.com/",
"url_donation_purchase": "https://www.gog.com/en/game/dink_smallwood_hd",
"url_source": "https://github.com/SethRobinson/RTDink",
"component_type": "Engine",
"name": "RTDink",
"description": "RTDink Engine for Dink Smallwood HD and dmods.",
"system_friendly_name": "Dink Smallwood HD",
"system": "dink",
"artwork": "artwork/thumb.png",
"version": "1.0.0",
"tags": [
"engine",
"game"
],
"es_de_config": {
"es_find_rules": {
"emulators": [
{
"name": "RTDINK",
"description": "RTDink - Dink Smallwood HD Engine",
"rules": [
{
"type": "staticpath",
"entries": [
"%COMPONENT_PATH%/component_launcher.sh"
]
}
]
}
]
},
"es_systems": [
{
"name": "dink",
"fullname": "Dink Smallwood HD",
"path": "%ROMPATH%/dink",
"extension": ".dink",
"commands": [
{
"label": "RTDink (Standalone)",
"command": "%EMULATOR_RTDINK% %ROM%"
}
],
"platform": "pc, pcwindows",
"theme": "dink"
}
]
}
}
"requires": [],
"artwork": "artwork/thumb.png"
}

View file

@ -8,17 +8,17 @@
"assets": [
{
"type": "file",
"source": "zork-trilogy/zork1.z3",
"source": "zork1.z3",
"dest": "$COMPONENT_ARTIFACT_ROOT"
},
{
"type": "file",
"source": "zork-trilogy/zork2.z3",
"source": "zork2.z3",
"dest": "$COMPONENT_ARTIFACT_ROOT"
},
{
"type": "file",
"source": "zork-trilogy/zork3.z3",
"source": "zork3.z3",
"dest": "$COMPONENT_ARTIFACT_ROOT"
},
{

View file

@ -18,17 +18,22 @@
"files": [
{
"source": "zork1.z3",
"destination": "$roms_folder/zmachine/zork1.z3",
"destination": "$roms_path/zmachine/zork1.z3",
"policy": "replace"
},
{
"source": "zork2.z3",
"destination": "$roms_folder/zmachine/zork2.z3",
"destination": "$roms_path/zmachine/zork2.z3",
"policy": "replace"
},
{
"source": "zork3.z3",
"destination": "$roms_folder/zmachine/zork3.z3",
"destination": "$roms_path/zmachine/zork3.z3",
"policy": "replace"
},
{
"source": "docs/LICENSE",
"destination": "$roms_path/zmachine/zork_docs/LICENSE",
"policy": "replace"
}
]