[release-1.10] fix publish action (#2759) #68
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.35.0 | |
steps: | |
- 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: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.19' | |
- name: Checkout the latest code of ${{ env.TARGET_BRANCH }} branch | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ env.TARGET_BRANCH }} | |
fetch-depth: 2 | |
- 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 Applications Images | |
env: | |
IMAGE_TAG: ${{ env.CSV_VERSION }} | |
run: | | |
IMAGE_TAG=${CSV_VERSION} make container-build | |
- name: Push Application Images | |
env: | |
IMAGE_TAG: ${{ env.CSV_VERSION }} | |
run: | | |
IMAGE_TAG=${IMAGE_TAG} make container-push | |
- 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}") | |
./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: | | |
wget https://github.com/operator-framework/operator-registry/releases/download/${OPM_VERSION}/linux-amd64-opm | |
chmod +x linux-amd64-opm | |
- name: Build and Push the Index Image | |
run: | | |
export OPM=$(pwd)/linux-amd64-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 Applications next version Images | |
env: | |
NEW_IMAGE_TAG: ${{ env.NEW_IMAGE_TAG }} | |
run: | | |
IMAGE_TAG=${NEW_IMAGE_TAG} make container-build | |
- name: Push next version Application Images | |
env: | |
NEW_IMAGE_TAG: ${{ env.NEW_IMAGE_TAG }} | |
run: | | |
IMAGE_TAG=${NEW_IMAGE_TAG} make container-push | |
- 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 | |
echo " - Image: quay.io/kubevirt/hyperconverged-cluster-bundle:${CSV_VERSION}" >> deploy/olm-catalog/community-kubevirt-hyperconverged/index-template-unstable.yaml | |
git add ./deploy/ | |
- uses: peter-evans/create-pull-request@v3 | |
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 | |
reviewers: tiraboschi,orenc1,nunnatsa | |
team-reviewers: owners, maintainers | |
branch: prepare_version_${{ env.NEW_VERSION }} | |