From 0fb252b6e4a34cdd58f7354fcdb9eccd3ec3dc67 Mon Sep 17 00:00:00 2001 From: Hao Liu <44379968+TheRealHaoLiu@users.noreply.github.com> Date: Wed, 8 Nov 2023 09:22:27 -0500 Subject: [PATCH] Fix operator-hub release CI when triggering from release (#1623) Fix operator-hub release CI When triggering from release default values for input is not accessible --- .github/workflows/publish-operator-hub.yaml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-operator-hub.yaml b/.github/workflows/publish-operator-hub.yaml index aaf82290..15dbaa8e 100644 --- a/.github/workflows/publish-operator-hub.yaml +++ b/.github/workflows/publish-operator-hub.yaml @@ -31,19 +31,27 @@ jobs: promote: runs-on: ubuntu-latest steps: - - name: Set TAG_NAME from workflow_dispatch event + - name: Set GITHUB_ENV from workflow_dispatch event if: ${{ github.event_name == 'workflow_dispatch' }} run: | echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV + echo "IMAGE_REGISTRY=${{ github.event.inputs.image_registry }}" >> $GITHUB_ENV + echo "IMAGE_REGISTRY_ORGANIZATION=${{ github.event.inputs.image_registry_organization }}" >> $GITHUB_ENV + echo "COMMUNITY_OPERATOR_GITHUB_ORG=${{ github.event.inputs.community_operator_github_org }}" >> $GITHUB_ENV + echo "COMMUNITY_OPERATOR_PROD_GITHUB_ORG=${{ github.event.inputs.community_operator_prod_github_org }}" >> $GITHUB_ENV - - name: Set TAG_NAME for release event + - name: Set GITHUB_ENV for release event if: ${{ github.event_name == 'release' }} run: | echo "TAG_NAME=${{ github.event.release.tag_name }}" >> $GITHUB_ENV + echo "IMAGE_REGISTRY=quay.io" >> $GITHUB_ENV + echo "IMAGE_REGISTRY_ORGANIZATION=ansible" >> $GITHUB_ENV + echo "COMMUNITY_OPERATOR_GITHUB_ORG=k8s-operatorhub" >> $GITHUB_ENV + echo "COMMUNITY_OPERATOR_PROD_GITHUB_ORG=redhat-openshift-ecosystem" >> $GITHUB_ENV - name: Log in to image registry run: | - echo ${{ secrets.QUAY_TOKEN }} | docker login ${{github.event.inputs.image_registry}} -u ${{ secrets.QUAY_USER }} --password-stdin + echo ${{ secrets.QUAY_TOKEN }} | docker login ${{ env.IMAGE_REGISTRY }} -u ${{ secrets.QUAY_USER }} --password-stdin - name: Checkout awx-operator at workflow branch uses: actions/checkout@v4 @@ -66,10 +74,8 @@ jobs: - name: Build and publish bundle to operator-hub working-directory: awx-operator-${{ env.TAG_NAME }} env: - IMG_REPOSITORY: ${{ github.event.inputs.image_registry }}/${{ github.event.inputs.image_registry_organization }} + IMG_REPOSITORY: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REGISTRY_ORGANIZATION }} GITHUB_TOKEN: ${{ secrets.AWX_AUTO_GITHUB_TOKEN }} - COMMUNITY_OPERATOR_GITHUB_ORG: ${{ github.event.inputs.community_operator_github_org }} - COMMUNITY_OPERATOR_PROD_GITHUB_ORG: ${{ github.event.inputs.community_operator_prod_github_org }} run: | git config --global user.email "awx-automation@redhat.com" git config --global user.name "AWX Automation"