mirror of
https://github.com/rommapp/romm.git
synced 2026-06-27 22:35:57 +00:00
add PR label to trigger preview build
This commit is contained in:
22
.github/workflows/test-build.yml
vendored
22
.github/workflows/test-build.yml
vendored
@@ -1,6 +1,8 @@
|
||||
name: Build Experimental Docker Image
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [labeled]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
# trunk-ignore(checkov/CKV_GHA_7)
|
||||
@@ -13,9 +15,13 @@ permissions:
|
||||
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
|
||||
@@ -28,7 +34,7 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4.3.0
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.head_ref }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up QEMU
|
||||
@@ -50,7 +56,7 @@ jobs:
|
||||
images: |
|
||||
name=rommapp/romm-testing
|
||||
tags: |
|
||||
type=raw,value=${{ github.event.inputs.branch }}
|
||||
type=raw,value=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.head_ref }}
|
||||
|
||||
- name: Build full image
|
||||
id: build-full
|
||||
@@ -62,3 +68,15 @@ jobs:
|
||||
platforms: linux/arm64,linux/amd64
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
target: full-image
|
||||
|
||||
- name: Comment PR with Docker image link
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: `✅ Docker image built successfully!\n\nDocker image: \`rommapp/romm-testing:${{ github.head_ref }}\``
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user