1
0
Fork 0
mirror of https://github.com/JasonN3/build-container-installer.git synced 2025-12-25 10:57:55 +01:00
This commit is contained in:
Jason N. 2024-03-19 17:41:55 -04:00
parent fadeb6fffb
commit ceccf8278d
2 changed files with 34 additions and 8 deletions

View file

@ -12,9 +12,7 @@ jobs:
build-container:
if: >
github.event_name == 'push' ||
github.event_name == 'issue_comment' ||
( github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'auto-test') )
github.event_name == 'issue_comment'
name: Build Container Image
env:
JOB_NAME: Build Container Image
@ -23,6 +21,18 @@ jobs:
contents: read
packages: write
statuses: write
strategy:
matrix:
os:
- registry.fedoraproject.org/fedora
- registry.access.redhat.com/ubi8/ubi
include:
- os: registry.fedoraproject.org/fedora
tag: 39
- os: registry.access.redhat.com/ubi8/ubi
tag: latest
append: ubi
steps:
- name: Checkout
uses: actions/checkout@v4
@ -66,7 +76,7 @@ jobs:
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
ghcr.io/${{ github.repository }}${{ matrix.append && format('-{0}', matrix.append) }}
tags: |
type=ref,event=branch
type=ref,event=pr
@ -79,10 +89,19 @@ jobs:
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
ghcr.io/${{ github.repository }}${{ matrix.append && format('-{0}', matrix.append) }}
tags: |
pr-${{ inputs.pr }}
- name: Get UBI Subs
if: matrix.append == 'ubi'
uses: actions/checkout@v4
with:
repository: ${{ secrets.RH_REPO }}
token: ${{ secrets.RH_ENT }}
persist-credentials: false
path: ubi
- name: Buildah Build
id: build-image
uses: redhat-actions/buildah-build@v2
@ -90,6 +109,11 @@ jobs:
containerfiles: Containerfile
tags: ${{ steps.meta.outputs.tags || steps.meta_pr.outputs.tags }}
labels: ${{ steps.meta.outputs.labels || steps.meta_pr.outputs.labels }}
build-args: |
BASE_IMAGE=${{ matrix.os }}
IMAGE_VERSION=${{ matrix.tag }}
extra-args: |
${{ matrix.append == 'ubi' && '--volume=./ubi:/etc/pki/entitlement-host' }}
- name: Push image
uses: redhat-actions/push-to-registry@v2
@ -107,4 +131,4 @@ jobs:
status: ${{ job.status }}
context: ${{ env.JOB_NAME }}
sha: ${{ env.sha }}
targetUrl: ${{ steps.jobs.outputs.html_url }}
targetUrl: ${{ steps.jobs.outputs.html_url }}