diff options
author | Shane McDonald <me@shanemcd.com> | 2024-04-10 17:56:18 +0200 |
---|---|---|
committer | Shane McDonald <me@shanemcd.com> | 2024-04-10 18:00:30 +0200 |
commit | f962c88df34a83cbb3cbca394b2716025e925ca7 (patch) | |
tree | 7c27ad23d8e19493b7a2f42162e4fced71905ccc /.github/workflows/promote.yml | |
parent | Check galaxy collection with and without redirect (diff) | |
download | awx-f962c88df34a83cbb3cbca394b2716025e925ca7.tar.xz awx-f962c88df34a83cbb3cbca394b2716025e925ca7.zip |
Allow for manually restarting promote workflow
The promote workflow recently failed. Since this was just a problem with our automation, it would be nice if we didn't have to do another release just to fix our tooling.
Diffstat (limited to '.github/workflows/promote.yml')
-rw-r--r-- | .github/workflows/promote.yml | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml index 0ff16aa32e..e9ed8d7408 100644 --- a/.github/workflows/promote.yml +++ b/.github/workflows/promote.yml @@ -7,7 +7,11 @@ env: on: release: types: [published] - + workflow_dispatch: + inputs: + tag_name: + description: 'Name for the tag of the release.' + required: true permissions: contents: read # to fetch code (actions/checkout) @@ -17,6 +21,16 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 90 steps: + - name: Set GitHub Env vars for workflow_dispatch event + if: ${{ github.event_name == 'workflow_dispatch' }} + run: | + echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV + + - name: Set GitHub Env vars if release event + if: ${{ github.event_name == 'release' }} + run: | + echo "TAG_NAME=${{ env.TAG_NAME }}" >> $GITHUB_ENV + - name: Checkout awx uses: actions/checkout@v3 @@ -43,18 +57,18 @@ jobs: - name: Build collection and publish to galaxy env: COLLECTION_NAMESPACE: ${{ env.collection_namespace }} - COLLECTION_VERSION: ${{ github.event.release.tag_name }} + COLLECTION_VERSION: ${{ env.TAG_NAME }} COLLECTION_TEMPLATE_VERSION: true run: | make build_collection - curl_with_redirects=$(curl --head -sLw '%{http_code}' https://galaxy.ansible.com/download/${{ env.collection_namespace }}-awx-${{ github.event.release.tag_name }}.tar.gz | tail -1) - curl_without_redirects=$(curl --head -sw '%{http_code}' https://galaxy.ansible.com/download/${{ env.collection_namespace }}-awx-${{ github.event.release.tag_name }}.tar.gz | tail -1) + curl_with_redirects=$(curl --head -sLw '%{http_code}' https://galaxy.ansible.com/download/${{ env.collection_namespace }}-awx-${{ env.TAG_NAME }}.tar.gz | tail -1) + curl_without_redirects=$(curl --head -sw '%{http_code}' https://galaxy.ansible.com/download/${{ env.collection_namespace }}-awx-${{ env.TAG_NAME }}.tar.gz | tail -1) if [[ "$curl_with_redirects" == "302" ]] || [[ "$curl_without_redirects" == "302" ]]; then echo "Galaxy release already done"; else ansible-galaxy collection publish \ --token=${{ secrets.GALAXY_TOKEN }} \ - awx_collection_build/${{ env.collection_namespace }}-awx-${{ github.event.release.tag_name }}.tar.gz; + awx_collection_build/${{ env.collection_namespace }}-awx-${{ env.TAG_NAME }}.tar.gz; fi - name: Set official pypi info @@ -86,14 +100,14 @@ jobs: - name: Re-tag and promote awx image run: | docker buildx imagetools create \ - ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }} \ - --tag quay.io/${{ github.repository }}:${{ github.event.release.tag_name }} + ghcr.io/${{ github.repository }}:${{ env.TAG_NAME }} \ + --tag quay.io/${{ github.repository }}:${{ env.TAG_NAME }} docker buildx imagetools create \ - ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }} \ + ghcr.io/${{ github.repository }}:${{ env.TAG_NAME }} \ --tag quay.io/${{ github.repository }}:latest - name: Re-tag and promote awx-ee image run: | docker buildx imagetools create \ - ghcr.io/${{ github.repository_owner }}/awx-ee:${{ github.event.release.tag_name }} \ - --tag quay.io/${{ github.repository_owner }}/awx-ee:${{ github.event.release.tag_name }} + ghcr.io/${{ github.repository_owner }}/awx-ee:${{ env.TAG_NAME }} \ + --tag quay.io/${{ github.repository_owner }}/awx-ee:${{ env.TAG_NAME }} |