Merge pull request #191 from mbaldessari/fix-csv #28
Workflow file for this run
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: vp-patterns/update-quay-image | |
on: | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
build_and_push_image: | |
name: Build and push pattern-operator image to quay.io | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check that tag version corresponds to metadata version | |
run: |- | |
VERSION=$(yq -r '.spec.version' bundle/manifests/patterns-operator.clusterserviceversion.yaml) | |
TAG=${{ github.ref_name }} | |
if [ "${VERSION}" != "${TAG}" ]; then | |
echo "Version in metadata ${VERSION} whereas tag is different: ${TAG}" | |
exit 1 | |
fi | |
- name: Check that both QUAY_ROBOT_USER and QUAY_ROBOT_TOKEN exist | |
run: |- | |
failed=0 | |
if [ -z "${{ secrets.QUAY_ROBOT_USER }}" ]; then | |
echo "QUAY_ROBOT_USER secret missing" | |
failed=1 | |
fi | |
if [ -z "${{ secrets.QUAY_ROBOT_TOKEN }}" ]; then | |
echo "QUAY_ROBOT_TOKEN secret missing" | |
failed=1 | |
fi | |
if [ ${failed} -eq 1 ]; then | |
echo "Erroring out due to missing secrets" | |
exit 1 | |
fi | |
- name: Build container and push it to quay.io | |
env: | |
KEY: ${{ secrets.API_KEY }} | |
run: |- | |
set -e | |
export VERSION=$(yq -r '.spec.version' bundle/manifests/patterns-operator.clusterserviceversion.yaml) | |
export REPO="quay.io/hybridcloudpatterns/patterns-operator" | |
export APIFILE="controllers/apikey.txt" | |
trap "rm -f ${APIFILE}" SIGINT EXIT | |
if [ -z "${KEY}" ]; then | |
echo "Key is empty" | |
echo '' > "${APIFILE}" | |
else | |
echo "Key is set" | |
echo "${KEY}" > "${APIFILE}" | |
fi | |
make docker-build | |
echo "${{ secrets.QUAY_ROBOT_TOKEN }}" | docker login -u="${{ secrets.QUAY_ROBOT_USER }}" --password-stdin quay.io | |
docker images | |
docker push "${REPO}:${VERSION}" |