Merge pull request #56 from slagle/bootc-workflow #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: edpm-bootc image builder | |
on: | |
push: | |
branches: | |
- '*' | |
paths: | |
- bootc/** | |
- .github/workflows/edpm-bootc.yaml | |
workflow_dispatch: | |
env: | |
imageregistry: 'quay.io' | |
imagenamespace: ${{ secrets.IMAGENAMESPACE || secrets.QUAY_USERNAME }} | |
latesttag: latest | |
defaults: | |
run: | |
shell: bash | |
working-directory: ./bootc | |
jobs: | |
check-secrets: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check secrets are set | |
id: have-secrets | |
if: "${{ env.imagenamespace != '' }}" | |
run: echo "ok=true" >> $GITHUB_OUTPUT | |
outputs: | |
have-secrets: ${{ steps.have-secrets.outputs.ok }} | |
build-edpm-bootc: | |
name: Build edpm-bootc using Makefile | |
runs-on: ubuntu-latest | |
needs: [check-secrets] | |
if: needs.check-secrets.outputs.have-secrets == 'true' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get branch name | |
id: branch-name | |
uses: tj-actions/branch-names@v5 | |
- name: Set latest tag for non main branch | |
if: "${{ steps.branch-name.outputs.current_branch != 'main' }}" | |
run: | | |
echo "latesttag=${{ steps.branch-name.outputs.current_branch }}-latest" >> $GITHUB_ENV | |
- name: Build edpm-bootc | |
id: build-edpm-bootc | |
run: | | |
export EDPM_BOOTC_TAG=${latesttag} | |
podman run --rm -it -v .:/bootc:rw,z quay.io/centos/centos:stream9 /bin/bash -c "cd bootc; dnf -y install make; make output/yum.repos.d" | |
make build | |
- name: Push edpm-bootc To ${{ env.imageregistry }} | |
id: push-edpm-bootc | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: edpm-bootc | |
tags: ${{ env.latesttag }} | |
registry: ${{ env.imageregistry }}/${{ env.imagenamespace }} | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_PASSWORD }} | |
- name: Print image url and digest | |
run: | | |
echo "Image pushed to ${{ steps.push-edpm-bootc.outputs.registry-paths }}" | |
echo "Image digest: ${{ steps.push-edpm-bootc.outputs.digest }}" |