ci: publish a rolling edge image from master

Every push to master builds and pushes rommapp/romm:edge (plus
edge-slim, edge-<sha> and edge-<sha>-slim) to Docker Hub and GHCR,
reusing the release build, merge and scan jobs. Release tagging is
unchanged: the semver rules emit nothing on a push and the edge rules
nothing on a release.

- Concurrency cancels a superseded edge build so an older commit
  cannot land on the tag last.
- Edge reads the release layer cache but writes its own scope, so
  master layers never seed a release image.
- The baked version is edge-<short sha>, which keeps version-keyed
  caches (ROM filter values) fresh between edge builds and makes bug
  reports identifiable. The v2 version display links it to the commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01817LYuBpFBV5Pi6VEcKfFZ
This commit is contained in:
Sam Dornan
2026-09-23 10:43:29 +00:00
committed by Claude
parent 74c8e4bfb5
commit 291f68aa18
4 changed files with 56 additions and 7 deletions

View File

@@ -6,6 +6,17 @@ on:
# - "[0-9]+.[0-9]+.[0-9]+*"
release:
types: [published]
# Rolling `edge` image of master.
push:
branches: [master]
paths-ignore:
- "**.md"
- "docs/**"
# Two quick merges must not race, or the older build could land on `edge` last.
concurrency:
group: build-${{ github.event_name == 'push' && 'edge' || github.ref }}
cancel-in-progress: ${{ github.event_name == 'push' }}
permissions:
contents: read
@@ -27,7 +38,7 @@ jobs:
env:
TAG: ${{ github.event.release.tag_name }}
run: |
if [[ "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+)?$ ]]; then
if [[ "$GITHUB_EVENT_NAME" == "push" || "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+)?$ ]]; then
echo "valid=true" >>"$GITHUB_OUTPUT"
else
echo "valid=false" >>"$GITHUB_OUTPUT"
@@ -54,6 +65,9 @@ jobs:
packages: write
env:
CACHE_IMAGE: ghcr.io/${{ github.repository_owner }}/romm-buildcache
# Edge reads the release cache but writes its own, so master layers never
# seed a release image.
CACHE_SCOPE: ${{ github.event_name == 'push' && 'edge' || 'release' }}
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -90,6 +104,8 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=edge,enable=${{ github.event_name == 'push' }}
type=sha,prefix=edge-,enable=${{ github.event_name == 'push' }}
labels: |
org.opencontainers.image.version={{version}}-slim
org.opencontainers.image.title="rommapp/romm"
@@ -107,16 +123,23 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=edge,enable=${{ github.event_name == 'push' }}
type=sha,prefix=edge-,enable=${{ github.event_name == 'push' }}
labels: |
org.opencontainers.image.version={{version}}
org.opencontainers.image.title="rommapp/romm"
org.opencontainers.image.description="RomM (ROM Manager) allows you to scan, enrich, and browse your game collection with a clean and responsive interface. With support for multiple platforms, various naming schemes and custom tags, RomM is a must-have for anyone who plays on emulators."
org.opencontainers.image.licenses="AGPLv3"
# Edge builds carry the short commit (matching the `edge-<sha>` tag) so each
# one is identifiable and busts version-keyed caches.
- name: Set version
env:
VERSION: ${{ steps.meta.outputs.version }}
run: |
if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
VERSION="${VERSION}-${GITHUB_SHA::7}"
fi
sed -i "s/<version>/$VERSION/" backend/__version__.py
- name: Build and push slim image by digest
@@ -135,7 +158,9 @@ jobs:
no-cache-filters: python-runtime,production-stage
# Deliberately not seeded from the preview cache: those layers are
# built from PR head content and must not reach a release image.
cache-from: type=registry,ref=${{ env.CACHE_IMAGE }}:release-${{ matrix.arch }}
cache-from: |
type=registry,ref=${{ env.CACHE_IMAGE }}:release-${{ matrix.arch }}
${{ env.CACHE_SCOPE == 'edge' && format('type=registry,ref={0}:edge-{1}', env.CACHE_IMAGE, matrix.arch) || '' }}
build-args: |
SCREENSCRAPER_DEV_ID=${{ secrets.SCREENSCRAPER_DEV_ID }}
SCREENSCRAPER_DEV_PASSWORD=${{ secrets.SCREENSCRAPER_DEV_PASSWORD }}
@@ -153,8 +178,10 @@ jobs:
target: full-image
outputs: type=image,name=${{ env.DIGEST_IMAGE }},push-by-digest=true,name-canonical=true,push=true
no-cache-filters: python-runtime,production-stage
cache-from: type=registry,ref=${{ env.CACHE_IMAGE }}:release-${{ matrix.arch }}
cache-to: type=registry,ref=${{ env.CACHE_IMAGE }}:release-${{ matrix.arch }},mode=max
cache-from: |
type=registry,ref=${{ env.CACHE_IMAGE }}:release-${{ matrix.arch }}
${{ env.CACHE_SCOPE == 'edge' && format('type=registry,ref={0}:edge-{1}', env.CACHE_IMAGE, matrix.arch) || '' }}
cache-to: type=registry,ref=${{ env.CACHE_IMAGE }}:${{ env.CACHE_SCOPE }}-${{ matrix.arch }},mode=max
build-args: |
SCREENSCRAPER_DEV_ID=${{ secrets.SCREENSCRAPER_DEV_ID }}
SCREENSCRAPER_DEV_PASSWORD=${{ secrets.SCREENSCRAPER_DEV_PASSWORD }}
@@ -235,6 +262,8 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=edge,enable=${{ github.event_name == 'push' }}
type=sha,prefix=edge-,enable=${{ github.event_name == 'push' }}
- name: Generate Docker metadata (full)
id: meta
@@ -247,6 +276,8 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=edge,enable=${{ github.event_name == 'push' }}
type=sha,prefix=edge-,enable=${{ github.event_name == 'push' }}
# Tags spanning both registries are fine here: `imagetools create` copies
# the blobs over when a target sits in a different registry than the digests.

View File

@@ -5,6 +5,7 @@ volumes:
services:
romm:
# `edge` tracks master: unstable, and its migrations can't be undone by returning to `latest`
image: rommapp/romm:latest
container_name: romm
restart: unless-stopped

View File

@@ -57,6 +57,16 @@ describe("useVersionDisplay", () => {
);
});
it("links an edge build to the commit it was built from", () => {
heartbeatStore = makeHeartbeatStore({
VERSION: "edge-a1b2c3d",
GIT_BRANCH: null,
});
const { version, href } = useVersionDisplay();
expect(version.value).toBe("edge-a1b2c3d");
expect(href.value).toBe("https://github.com/rommapp/romm/commit/a1b2c3d");
});
it("encodes URL-reserved characters within a branch segment", () => {
heartbeatStore = makeHeartbeatStore({
VERSION: "development",

View File

@@ -1,8 +1,11 @@
// The version to display and where it should link. Shows the branch on a
// dev build, when known, instead of the bare "development" placeholder.
// dev build, when known, instead of the bare "development" placeholder, and
// links an edge build (`edge-<short sha>`, built from master) to its commit.
import { computed } from "vue";
import storeHeartbeat from "@/stores/heartbeat";
const EDGE_VERSION_RE = /^edge-([0-9a-f]{7,40})$/;
export function useVersionDisplay() {
const heartbeatStore = storeHeartbeat();
@@ -22,8 +25,12 @@ export function useVersionDisplay() {
?.split("/")
.map(encodeURIComponent)
.join("/");
return encodedBranch
? `https://github.com/rommapp/romm/tree/${encodedBranch}`
if (encodedBranch) {
return `https://github.com/rommapp/romm/tree/${encodedBranch}`;
}
const edgeCommit = EDGE_VERSION_RE.exec(version.value)?.[1];
return edgeCommit
? `https://github.com/rommapp/romm/commit/${edgeCommit}`
: `https://github.com/rommapp/romm/releases/tag/${version.value}`;
});