Files
romm/.github/workflows/build.yml
Sam Dornan 2539520de4 Bump GitHub Actions to Node 24 runtimes
GitHub is deprecating the Node 20 action runtime. Every third-party action
in the workflows was still pinned to a Node 20 release, so each is moved to
its latest release, all of which declare `runs.using: node24`:

- actions/checkout v4.3.x -> v7.0.1
- astral-sh/setup-uv v6.7.0 -> v10.0.1
- docker/login-action v3.5.0 -> v4.6.0
- docker/metadata-action v5.8.0 -> v6.2.0
- docker/build-push-action v6.18.0 -> v7.3.0
- docker/setup-qemu-action v3.6.0 -> v4.3.0
- docker/setup-buildx-action v3.11.1 -> v4.3.0
- actions/github-script v7.1.0 -> v9.0.0
- actions/upload-artifact v4.6.2 -> v7.0.1
- peter-evans/create-pull-request v7.0.11 -> v8.1.1
- trunk-io/trunk-action v1.2.4 -> v2.0.0 (its nested actions were on Node 20)

actions/setup-node and actions/setup-python were already on Node 24 but are
bumped to v7.0.0 as well, and the setup-node reference in the trunk
setup-ci composite action is now SHA-pinned like the rest.

None of the removed inputs, deprecated envs, or event-specific behavior
changes in the crossed major versions are used by these workflows.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-03 21:45:49 -05:00

163 lines
6.0 KiB
YAML

name: Build Docker Image and Trigger Docs/Website
on:
# push:
# tags:
# - "[0-9]+.[0-9]+.[0-9]+*"
release:
types: [published]
permissions:
id-token: write
contents: write
packages: write
actions: write
jobs:
validate-tag-semver:
runs-on: ubuntu-latest
outputs:
valid: ${{ steps.check_tag.outputs.valid }}
steps:
- name: Check if tag follows SemVer
id: check_tag
run: |
TAG="${{ github.event.release.tag_name }}"
if [[ "$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
fi
build:
needs: validate-tag-semver
runs-on: ubuntu-latest
if: needs.validate-tag-semver.outputs.valid == 'true'
permissions:
id-token: write
contents: write
packages: write
steps:
- name: Run only once per release
run: echo "Triggered by ${{ github.event_name }}"
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up QEMU
uses: docker/setup-qemu-action@1f40c72289eff860ee54a304f1438e3cff362e0a # v4.3.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
- name: Login to Docker Hub
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate Docker metadata (slim)
id: meta-slim
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
images: |
name=rommapp/romm
name=ghcr.io/rommapp/romm
flavor: |
latest=auto
suffix=-slim,onlatest=true
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
labels: |
org.opencontainers.image.version={{version}}-slim
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"
- name: Generate Docker metadata (full)
id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
images: |
name=rommapp/romm
name=ghcr.io/rommapp/romm
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
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"
- name: Set version
run: |
sed -i 's/<version>/${{ steps.meta.outputs.version }}/' backend/__version__.py
- name: Build slim image
id: build-slim
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
file: docker/Dockerfile
context: .
push: true
platforms: linux/arm64,linux/amd64
tags: ${{ steps.meta-slim.outputs.tags }}
labels: ${{ steps.meta-slim.outputs.labels }}
target: slim-image
build-args: |
SCREENSCRAPER_DEV_ID=${{ secrets.SCREENSCRAPER_DEV_ID }}
SCREENSCRAPER_DEV_PASSWORD=${{ secrets.SCREENSCRAPER_DEV_PASSWORD }}
- name: Build full image
id: build-full
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
file: docker/Dockerfile
context: .
push: true
platforms: linux/arm64,linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: full-image
build-args: |
SCREENSCRAPER_DEV_ID=${{ secrets.SCREENSCRAPER_DEV_ID }}
SCREENSCRAPER_DEV_PASSWORD=${{ secrets.SCREENSCRAPER_DEV_PASSWORD }}
trigger-docs-and-web:
permissions:
actions: write
needs: build
runs-on: ubuntu-latest
if: needs.build.result == 'success' && github.event.release.prerelease == false
steps:
- name: Trigger docs build
run: |
curl -L -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${DOCS_PAT}" \
"https://api.github.com/repos/rommapp/docs/actions/workflows/deploy.yml/dispatches" \
-d '{"ref":"main", "inputs": {"version": "${{ github.event.release.tag_name }}"}}'
env:
DOCS_PAT: ${{ secrets.DOCS_PAT }}
- name: Trigger website build
run: |
curl -L -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${DOCS_PAT}" \
"https://api.github.com/repos/rommapp/marketing-site/actions/workflows/deploy.yml/dispatches" \
-d '{"ref":"main", "inputs": {"version": "${{ github.event.release.tag_name }}"}}'
env:
DOCS_PAT: ${{ secrets.DOCS_PAT }}