Skip to content

fix(deps): update github.com/openshift/api digest to c1a063b (#651) #387

fix(deps): update github.com/openshift/api digest to c1a063b (#651)

fix(deps): update github.com/openshift/api digest to c1a063b (#651) #387

# for main branch, use next tags; for 1.y branches, use :latest tags
name: Build and push operator, bundle, and catalog images
on:
push:
branches:
- main
- rhdh-1.[0-9]+
- 1.[0-9]+.x
- release-1.[0-9]+
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: ${{ vars.REGISTRY }}
jobs:
next-build:
name: Next build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
# check changes in this commit for regex include and exclude matches
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45.0.6
with:
files: |
.github/workflows/next-container-build.yaml
Makefile
**/*.go
bundle/**
config/**
go.mod
go.sum
LICENSE
**/Dockerfile
**/Containerfile
**/*.Dockerfile
**/.dockerignore
files_ignore: |
**/*.md
**/*.adoc
.rhdh/**
tests/**
- name: List all changed files (for troubleshooting)
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
- name: Get the last commit short SHA
# run this stage only if there are changes that match the includes and not the excludes
if: steps.changed-files.outputs.any_changed == 'true'
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
echo "SHORT_SHA=$SHORT_SHA" >> $GITHUB_ENV
BASE_VERSION=$(grep -E "^VERSION \?=" Makefile | sed -r -e "s/.+= //") # 0.0.1
echo "BASE_VERSION=$BASE_VERSION" >> $GITHUB_ENV
- name: Setup Go
# run this stage only if there are changes that match the includes and not the excludes
if: steps.changed-files.outputs.any_changed == 'true'
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5
with:
go-version-file: 'go.mod'
- name: Login to registry (${{env.REGISTRY}})
# run this stage only if there are changes that match the includes and not the excludes
if: steps.changed-files.outputs.any_changed == 'true'
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ vars.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Build and push operator, bundle, and catalog images
# run this stage only if there are changes that match the includes and not the excludes
if: steps.changed-files.outputs.any_changed == 'true'
run: |
# install skopeo, podman
sudo apt-get -y update; sudo apt-get -y install skopeo podman
export CONTAINER_TOOL=podman
latestNext="next"
# for main branch, use next tags; for 1.y branches, use :latest tags
if [[ $(git rev-parse --abbrev-ref HEAD) != "main" ]]; then
latestNext="latest"
fi
export VERSION=${{ env.BASE_VERSION }}
export REGISTRY_WITH_ORG=${{ env.REGISTRY }}/${{ env.REGISTRY_ORG }}
export OPERATOR_IMAGE_NAME=${OPERATOR_IMAGE_NAME:-operator}
export IMAGE_TAG_BASE=${REGISTRY_WITH_ORG}/${OPERATOR_IMAGE_NAME}
set -ex
# build 4 container images with a 14d expiry
CONTAINER_TOOL=${CONTAINER_TOOL} VERSION=${VERSION} make release-build
# now copy images from local cache to quay, using 0.0.1-next-f00cafe, 0.0.1-next, and next tags
for image in ${OPERATOR_IMAGE_NAME} ${OPERATOR_IMAGE_NAME}-bundle ${OPERATOR_IMAGE_NAME}-catalog; do
podman push -q ${REGISTRY_WITH_ORG}/${image}:${VERSION} docker://${REGISTRY_WITH_ORG}/${image}:${VERSION}
skopeo --insecure-policy copy --all docker://${REGISTRY_WITH_ORG}/${image}:${VERSION} docker://${REGISTRY_WITH_ORG}/${image}:${VERSION}-${{ env.SHORT_SHA }}
skopeo --insecure-policy copy --all docker://${REGISTRY_WITH_ORG}/${image}:${VERSION} docker://${REGISTRY_WITH_ORG}/${image}:${latestNext}
done
env:
REGISTRY_ORG: ${{ vars.REGISTRY_ORG }}
OPERATOR_IMAGE_NAME: ${{ vars.OPERATOR_IMAGE_NAME }}
# to avoid throttling on RHD org, use GH token
GH_TOKEN: ${{ secrets.RHDH_BOT_TOKEN }}