[Release 1.14] Fix the publish github action (#3324) #92
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: Publish Tagged Version to Community Operators | |
on: | |
push: | |
tags: | |
- v1.* | |
jobs: | |
publish_hco: | |
if: (github.repository == 'kubevirt/hyperconverged-cluster-operator' && !contains(github.ref, 'unstable')) | |
name: Publish HCO tagged version to community-operators | |
runs-on: ubuntu-latest | |
env: | |
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }} | |
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }} | |
REGISTRY_NAMESPACE: kubevirt | |
OPM_VERSION: v1.47.0 | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: resolve the correct branch of the tag | |
run: | | |
GIT_TAG=${{ github.ref }} | |
TAGGED_VERSION=${GIT_TAG##*/v} | |
TAGGED_MINOR_VERSION=${TAGGED_VERSION%.*} | |
REPO_BRANCHES=$(curl https://api.github.com/repos/kubevirt/hyperconverged-cluster-operator/branches | jq .[].name) | |
if [[ "${REPO_BRANCHES[@]}" =~ "release-${TAGGED_MINOR_VERSION}" ]] | |
then | |
TARGET_BRANCH=release-${TAGGED_MINOR_VERSION} | |
else | |
TARGET_BRANCH=main | |
fi | |
echo "TARGET_BRANCH=${TARGET_BRANCH}" >> $GITHUB_ENV | |
echo "TAGGED_VERSION=${TAGGED_VERSION}" >> $GITHUB_ENV | |
- name: Checkout the latest code of ${{ env.TARGET_BRANCH }} branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.TARGET_BRANCH }} | |
fetch-depth: 2 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Get latest version on ${{ env.TARGET_BRANCH }} branch | |
run: | | |
PACKAGE_DIR="./deploy/olm-catalog/community-kubevirt-hyperconverged" | |
CSV_VERSION=$(ls -d ${PACKAGE_DIR}/*/ | sort -rV | awk "NR==1" | cut -d '/' -f 5) | |
echo "CSV_VERSION=${CSV_VERSION}" >> $GITHUB_ENV | |
echo "PACKAGE_DIR=${PACKAGE_DIR}" >> $GITHUB_ENV | |
- name: Build and Push Applications Images | |
env: | |
IMAGE_TAG: ${{ env.CSV_VERSION }} | |
run: | | |
make quay-login | |
IMAGE_TAG=${CSV_VERSION} make build-push-multi-arch-images | |
- name: Build Digester | |
run: | | |
(cd tools/digester && go build .) | |
- name: Build Manifests for version ${{ env.CSV_VERSION }} | |
env: | |
PACKAGE_DIR: ${{ env.PACKAGE_DIR }} | |
CSV_VERSION: ${{ env.CSV_VERSION }} | |
run: | | |
export HCO_OPERATOR_IMAGE=$(tools/digester/digester --image="quay.io/kubevirt/hyperconverged-cluster-operator:${CSV_VERSION}") | |
export HCO_WEBHOOK_IMAGE=$(tools/digester/digester --image="quay.io/kubevirt/hyperconverged-cluster-webhook:${CSV_VERSION}") | |
export HCO_DOWNLOADS_IMAGE=$(tools/digester/digester --image="quay.io/kubevirt/virt-artifacts-server:${CSV_VERSION}") | |
./hack/build-manifests.sh | |
sed -i "/^ \+replaces:/d" ${PACKAGE_DIR}/${CSV_VERSION}/manifests/kubevirt-hyperconverged-operator.v${CSV_VERSION}.clusterserviceversion.yaml | |
- name: Get opm client | |
run: | | |
mkdir -p _out | |
wget "https://github.com/operator-framework/operator-registry/releases/download/${OPM_VERSION}/linux-amd64-opm" -O _out/opm | |
chmod +x _out/opm | |
- name: Build and Push the Index Image | |
run: | | |
export OPM=$(pwd)/_out/opm | |
./hack/build-index-image.sh ${{ env.CSV_VERSION }} | |
- name: Run Publisher script | |
run: | | |
export TAGGED_VERSION=${{ env.TAGGED_VERSION }} | |
export TARGET_BRANCH=${{ env.TARGET_BRANCH }} | |
export HCO_BOT_TOKEN=${{ secrets.HCO_BOT_TOKEN }} | |
curl https://raw.githubusercontent.com/kubevirt/hyperconverged-cluster-operator/main/automation/publisher/publisher.sh | bash | |
- name: get next version | |
env: | |
CSV_VERSION: ${{ env.CSV_VERSION }} | |
run: | | |
NEW_VERSION=$(./hack/get-next-version.sh "${CSV_VERSION}") | |
NEW_IMAGE_TAG="${NEW_VERSION}-unstable" | |
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV | |
echo "NEW_IMAGE_TAG=${NEW_IMAGE_TAG}" >> $GITHUB_ENV | |
- name: Build and Push Applications next version Images | |
env: | |
NEW_IMAGE_TAG: ${{ env.NEW_IMAGE_TAG }} | |
run: | | |
IMAGE_TAG=${NEW_IMAGE_TAG} make build-push-multi-arch-images | |
- name: run manifest for next version | |
env: | |
PACKAGE_DIR: ${{ env.PACKAGE_DIR }} | |
CSV_VERSION: ${{ env.NEW_VERSION }} | |
run: | | |
mkdir -p "${PACKAGE_DIR}/${CSV_VERSION}" | |
./hack/build-manifests.sh | |
VERSION_4_SED=$(echo "${CSV_VERSION}" | sed -E "s|\.|\\\\\\\\\\\.|g") | |
sed -i -E "s|(ARG VERSION=).*|\1${CSV_VERSION}|g" deploy/index-image/bundle.Dockerfile | |
sed -i -E "s|(ARG INITIAL_VERSION=).*|\1${CSV_VERSION}|g;s|(ARG INITIAL_VERSION_SED=).*|\1\"${VERSION_4_SED}\"|g" deploy/index-image/Dockerfile.bundle.ci-index-image-upgrade | |
sed -i -E "s|(ARG VERSION=).*|\1${CSV_VERSION}|g" deploy/olm-catalog/bundle.Dockerfile | |
sed -i -E "s|(ARG INITIAL_VERSION=).*|\1${CSV_VERSION}|g;s|(ARG INITIAL_VERSION_SED=).*|\1\"${VERSION_4_SED}\"|g" deploy/olm-catalog/Dockerfile.bundle.ci-index-image-upgrade | |
sed -i -E "s|(quay.io/kubevirt/hyperconverged-cluster-bundle:).*|\1${CSV_VERSION}|g" deploy/olm-catalog/community-kubevirt-hyperconverged/index-template-release.yaml | |
sed -i -E "s|(quay.io/kubevirt/hyperconverged-cluster-bundle:).*|\1${CSV_VERSION}|g" deploy/olm-catalog/community-kubevirt-hyperconverged/index-template-unstable.yaml | |
git add ./deploy/ | |
echo "CHANGED=true" >> $GITHUB_ENV | |
- uses: peter-evans/create-pull-request@v6 | |
if: ${{ env.CHANGED }} | |
with: | |
token: ${{ secrets.HCO_BOT_TOKEN }} | |
commit-message: | | |
Prepare version ${{ env.NEW_VERSION }} | |
Signed-off-by: HCO Bump Bot <[email protected]> | |
committer: HCO Bump Bot <[email protected]> | |
title: "Prepare version ${{ env.NEW_VERSION }}" | |
body: | | |
Prepare version ${{ env.NEW_VERSION }} | |
Executed by HCO Release-Bumper Bot. | |
```release-note | |
Prepare version ${{ env.NEW_VERSION }} | |
``` | |
assignees: tiraboschi,orenc1,nunnatsa,machadovilaca,dharmit | |
reviewers: tiraboschi,orenc1,nunnatsa,machadovilaca,dharmit | |
branch: prepare_version_${{ env.NEW_VERSION }} |