mirror of
https://github.com/rommapp/romm.git
synced 2026-11-28 17:48:31 +01:00
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>
130 lines
4.8 KiB
YAML
130 lines
4.8 KiB
YAML
name: Build Experimental Docker Image
|
|
|
|
on:
|
|
pull_request:
|
|
types: [labeled]
|
|
workflow_dispatch:
|
|
inputs:
|
|
# trunk-ignore(checkov/CKV_GHA_7)
|
|
branch:
|
|
description: "Git branch"
|
|
required: true
|
|
registry:
|
|
description: "Container registry"
|
|
required: true
|
|
default: "ghcr"
|
|
type: choice
|
|
options:
|
|
- ghcr
|
|
- dockerhub
|
|
- both
|
|
|
|
permissions:
|
|
id-token: write
|
|
contents: write
|
|
packages: write
|
|
actions: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
build:
|
|
if: |
|
|
github.event_name == 'workflow_dispatch' ||
|
|
contains(github.event.pull_request.labels.*.name, 'build-preview')
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
id-token: write
|
|
contents: write
|
|
packages: write
|
|
pull-requests: write
|
|
env:
|
|
USE_GHCR: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.registry == 'ghcr' || github.event.inputs.registry == 'both' }}
|
|
USE_DOCKERHUB: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.registry == 'dockerhub' || github.event.inputs.registry == 'both') }}
|
|
# Key the Docker Hub namespace off the push credential rather than the GitHub owner.
|
|
DOCKERHUB_NAMESPACE: ${{ secrets.DOCKER_NAMESPACE || secrets.DOCKER_USERNAME || github.repository_owner }}
|
|
steps:
|
|
- name: Run only once per workflow
|
|
run: echo "Triggered by ${{ github.event_name }}"
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.head_ref }}
|
|
fetch-depth: 0
|
|
|
|
- name: PR comment build starting
|
|
if: github.event_name == 'pull_request'
|
|
id: build-comment
|
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
with:
|
|
script: |
|
|
const comment = await github.rest.issues.createComment({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
body: `🔨 Preview build is under way...`
|
|
});
|
|
core.setOutput('comment-id', comment.data.id);
|
|
|
|
- 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 GHCR
|
|
if: env.USE_GHCR == 'true'
|
|
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Login to Docker Hub
|
|
if: env.USE_DOCKERHUB == 'true'
|
|
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Generate Docker metadata
|
|
id: meta
|
|
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
|
|
with:
|
|
images: |
|
|
${{ env.USE_GHCR == 'true' && format('name=ghcr.io/{0}/romm-testing', github.repository_owner) || '' }}
|
|
${{ env.USE_DOCKERHUB == 'true' && format('name={0}/romm-testing', env.DOCKERHUB_NAMESPACE) || '' }}
|
|
tags: |
|
|
type=raw,value=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.head_ref }}
|
|
|
|
- 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 }}
|
|
target: full-image
|
|
build-args: |
|
|
SCREENSCRAPER_DEV_ID=${{ secrets.SCREENSCRAPER_DEV_ID }}
|
|
SCREENSCRAPER_DEV_PASSWORD=${{ secrets.SCREENSCRAPER_DEV_PASSWORD }}
|
|
|
|
# PR builds always push to GHCR only, so the image link is hardcoded to GHCR.
|
|
- name: Comment PR with GHCR image link
|
|
if: github.event_name == 'pull_request'
|
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
env:
|
|
HEAD_REF: ${{ github.head_ref }}
|
|
with:
|
|
script: |
|
|
const owner = context.repo.owner;
|
|
const tag = process.env.HEAD_REF;
|
|
github.rest.issues.updateComment({
|
|
comment_id: ${{ steps.build-comment.outputs.comment-id }},
|
|
owner: owner,
|
|
repo: context.repo.repo,
|
|
body: `✅ Preview build completed!\n\nDocker image: \`ghcr.io/${owner}/romm-testing:${tag}\``
|
|
})
|