bootc-base-images/.github/workflows/build-and-push-image.yml

67 lines
1.7 KiB
YAML

name: Build and Push Image
on:
pull_request:
branches:
- main
paths-ignore:
- "docs/**"
push:
branches:
- main
paths-ignore:
- "docs/**"
workflow_dispatch:
env:
REGISTRY: quay.io
QUAY_ORG: centos-bootc
jobs:
build-and-push-image:
runs-on: ubuntu-latest
container:
image: quay.io/centos-bootc/builder:latest
options: --privileged
strategy:
matrix:
os: [fedora, centos]
include:
- os: fedora
version: eln
- os: centos
version: stream9
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Workaround git safe.directory
run: git config --global --add safe.directory '*'
- name: Set SOURCE_DATE_EPOCH
run: echo SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) >> $GITHUB_ENV
- name: Login to quay.io
run: |
echo "${{ secrets.QUAY_PASSWORD }}" | skopeo login -u "${{ secrets.QUAY_USER }}" \
--password-stdin ${{ env.REGISTRY }}
if: ${{ github.event_name == 'push' }}
- name: Build
run: |
rpm-ostree compose image --format=ociarchive \
--initialize ${{ matrix.os }}-bootc.yaml dest.oci-archive
if: ${{ github.event_name == 'pull_request' }}
- name: Build and Push
run: |
rpm-ostree compose image --initialize-mode if-not-exists \
--format=registry ${{ matrix.os }}-bootc.yaml \
${{ env.REGISTRY }}/${{ env.QUAY_ORG }}/${{ matrix.os }}-bootc:${{ matrix.version }}
if: ${{ github.event_name == 'push' }}