Bump golang.org/x/mod from 0.16.0 to 0.18.0 #595
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: Build operator | |
on: | |
release: | |
types: [published] | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
pull_request: | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
OPERATOR_OCP_VERSION: "4.14.0" | |
OPERATOR_SDK_VERSION: "v1.31.0" | |
SUPPORTED_OCP_VERSIONS: "v4.12-v4.14" | |
jobs: | |
build-operator: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
- name: Set release version | |
if: ${{ github.event_name == 'release' }} | |
run: | | |
tag=${{ github.ref_name }} | |
echo "VERSION=${tag:1}" >> $GITHUB_ENV | |
echo "CHANNELS=stable" >> $GITHUB_ENV | |
echo "DEFAULT_CHANNEL=stable" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Setup registry access | |
run: echo "$PULL_SECRET" > ~/.docker/config.json | |
env: | |
PULL_SECRET: ${{ secrets.PULL_SECRET }} | |
- name: Log in to Quay.io | |
uses: docker/login-action@v3 | |
if: ${{ github.event_name != 'pull_request' }} | |
with: | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_PASSWORD }} | |
registry: quay.io | |
- name: install yq | |
run: | | |
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq | |
chmod +x /usr/local/bin/yq | |
- name: install operator-sdk | |
run: | | |
export OPERATOR_SDK_DL_URL=https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/operator-sdk/${{ env.OPERATOR_OCP_VERSION }}/operator-sdk-${{ env.OPERATOR_SDK_VERSION }}-ocp-linux-x86_64.tar.gz | |
curl -L ${OPERATOR_SDK_DL_URL} | tar -xz --strip-components=2 -C /usr/local/bin ./x86_64/operator-sdk | |
- name: Build operator | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
make docker-build | |
- name: Push operator | |
if: ${{ github.event_name != 'pull_request' }} | |
run: | | |
make docker-buildx PLATFORMS=linux/arm64,linux/amd64 | |
- name: Generate operator bundle | |
run: | | |
if [[ ${EVENT_NAME} != "pull_request" ]]; then | |
export USE_IMAGE_DIGESTS=true | |
fi | |
make bundle | |
echo -e "\n # Annotations for catalog\n com.redhat.openshift.versions: \"${{ env.SUPPORTED_OCP_VERSIONS }}\"" >> bundle/metadata/annotations.yaml | |
echo -e "\n# Labels for catalog\nLABEL com.redhat.openshift.versions=\"${{ env.SUPPORTED_OCP_VERSIONS }}\"" >> bundle.Dockerfile | |
export CONTAINER_IMAGE=$(cat bundle/manifests/cluster-relocation-operator.clusterserviceversion.yaml | yq '.spec.relatedImages | map(select(.name == "manager")) | .[0].image') | |
yq -i e ".metadata.annotations.containerImage = \"${CONTAINER_IMAGE}\"" bundle/manifests/cluster-relocation-operator.clusterserviceversion.yaml | |
env: | |
EVENT_NAME: ${{ github.event_name }} | |
- name: Build operator bundle | |
run: | | |
make bundle-build | |
- name: Validate bundle | |
run: | | |
operator-sdk bundle validate ./bundle --select-optional suite=operatorframework | |
- name: push bundle | |
if: ${{ github.event_name != 'pull_request' }} | |
run: | | |
make bundle-push | |
- name: build catalog | |
run: | | |
make catalog-build | |
- name: push catalog | |
if: ${{ github.event_name != 'pull_request' }} | |
run: | | |
make catalog-push | |
- name: Save bundle | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bundle | |
path: bundle/ |