Skip to content

Build and publish release containers to quay.io #44

Build and publish release containers to quay.io

Build and publish release containers to quay.io #44

Workflow file for this run

name: Build and publish release containers to quay.io
on:
release:
types: [published]
# Manual dispatch: requires version string from github's GUI.
workflow_dispatch:
inputs:
version:
type: string
description: 'Version (Semating Versioning) for the new release. E.g: 0.0.1'
required: true
default: '0.0.1'
env:
REGISTRY: quay.io
REGISTRY_USER: redhat-best-practices-for-k8s
REPO_BASE_NAME: certsuite-operator
TERM: xterm-color
jobs:
publish_new_version:
name: Build and publish release containers to quay.io
runs-on: ubuntu-22.04
env:
SHELL: /bin/bash
steps:
- name: Set release version output var depending on the trigger type.
run: |
if [ ${GITHUB_EVENT_NAME} == "workflow_dispatch" ]; then
VERSION=${{ inputs.version }}
echo "Manually triggered workflow to make release ${VERSION}"
else
VERSION=${{ github.ref_name }}
echo "New release published: ${VERSION}"
fi
REPO=${REGISTRY}/${REGISTRY_USER}/${REPO_BASE_NAME}
echo "VERSION=${VERSION}" >> ${GITHUB_ENV}
echo "IMG=${REPO}:v${VERSION}" >> ${GITHUB_ENV}
echo "SIDECAR_IMG=${REPO}-sidecar:v${VERSION}" >> ${GITHUB_ENV}
echo "BUNDLE_IMG=${REPO}-bundle:v${VERSION}" >> ${GITHUB_ENV}
echo "CATALOG_IMG=${REPO}-catalog:v${VERSION}" >> ${GITHUB_ENV}
- name: Print release images versions
run: |
echo "Release version to build: ${VERSION}"
echo " - Controller : ${IMG}"
echo " - Sidecar : ${SIDECAR_IMG}"
echo " - Bundle : ${BUNDLE_IMG}"
echo " - Catalog : ${CATALOG_IMG}"
- name: Authenticate against Quay.io
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_ROBOT_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
- name: Set up Go 1.23
uses: actions/setup-go@v5
with:
go-version: 1.23.2
- name: Disable default go problem matcher
run: echo "::remove-matcher owner=go::"
- name: Download operator-sdk
env:
OPERATOR_SDK_BIN: operator-sdk_linux_amd64
OPERATOR_SDK_DL_URL: https://github.com/operator-framework/operator-sdk/releases/download/v1.36.1
OPERATOR_SDK_DEST_FOLDER: /usr/local/bin
run: |
curl --location --remote-name ${OPERATOR_SDK_DL_URL}/${OPERATOR_SDK_BIN}
chmod +x ${OPERATOR_SDK_BIN}
sudo mv ${OPERATOR_SDK_BIN} ${OPERATOR_SDK_DEST_FOLDER}/operator-sdk
operator-sdk version
- name: Check out the repo.
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Build and push sidecar app image
run: docker build --no-cache -t "${SIDECAR_IMG}" -f certsuite-sidecar/Dockerfile . && docker push ${SIDECAR_IMG}
- name: Build and push controller image
run: make docker-build docker-push
- name: Build and push bundle image
run: |
rm bundle/manifests/* || true
make bundle
make bundle-build bundle-push
- name: Build and push catalog image
run: make catalog-build catalog-push