diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index 78fa8f3..71359d5 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -6,6 +6,11 @@ on: - "master" tags: - v* + workflow_dispatch: + inputs: + tag: + required: true + description: e.g. v22 jobs: build: @@ -24,7 +29,12 @@ jobs: path: /tmp - name: "Get Tag Name" id: get_tag_name - run: echo "TAG_NAME=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV + run: | + if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ github.event.inputs.tag }}" != "" ]]; then + echo "TAG_NAME=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT + else + echo "TAG_NAME=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT + fi - name: "Load Docker Images" id: load_images run: | diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index b2daaa4..3a0f164 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -26,15 +26,17 @@ jobs: uses: actions/download-artifact@v2 with: path: /tmp + - name: "Get Branch Name" + id: get_branch_name + run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT - name: "Load Docker Images" id: load_images run: | TAGS="" - BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/}) for f in $(find /tmp -type f -iname 'docker-image-*.tar' -print); do ARCH=$(echo ${f} | sed -E 's/.*docker-image-(.*).tar/\1/') docker load --input ${f} - TAG="mitchtalmadge/amp-dockerized:${BRANCH_NAME}-${ARCH}" + TAG="mitchtalmadge/amp-dockerized:${{ steps.get_branch_name.outputs.BRANCH_NAME }}-${ARCH}" TAGS="${TAGS} ${TAG}" docker tag amp-dockerized:latest ${TAG} done @@ -49,7 +51,6 @@ jobs: run: docker image push --all-tags mitchtalmadge/amp-dockerized - name: "Deploy Multi-Arch Manifest" run: | - BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/}) - MANIFEST="mitchtalmadge/amp-dockerized:${BRANCH_NAME}" + MANIFEST="mitchtalmadge/amp-dockerized:${{ steps.get_branch_name.outputs.BRANCH_NAME }}" docker manifest create ${MANIFEST} ${{ steps.load_images.outputs.TAGS }} docker manifest push ${MANIFEST}