From 1dc881b5e063b9c0490d67acc58861bf874b2930 Mon Sep 17 00:00:00 2001 From: Landon Pierce Date: Thu, 23 Jun 2022 14:31:41 -0400 Subject: [PATCH] update builds to make them a bit more generic --- .../container-image-build-saas-admin-tag.yml | 14 +++++----- ...ainer-image-build-saas-application-tag.yml | 15 +++++------ ...ainer-image-build-saas-permissions-tag.yml | 14 +++++----- ...ge-build-saas-signupadministration-tag.yml | 14 +++++----- .../template-container-image-build.yml | 26 ++++++++++++------- 5 files changed, 44 insertions(+), 39 deletions(-) diff --git a/.github/workflows/container-image-build-saas-admin-tag.yml b/.github/workflows/container-image-build-saas-admin-tag.yml index 774f986d..77967867 100644 --- a/.github/workflows/container-image-build-saas-admin-tag.yml +++ b/.github/workflows/container-image-build-saas-admin-tag.yml @@ -14,10 +14,10 @@ jobs: tag_name: ${GITHUB_REF/refs\/tags\//} # Add webhook jobs below here for each environment you want to automatically update - webhook-dev: - name: Image Build Webhook - Dev - needs: build-image - if: needs.build-image.result == 'success' - uses: Azure/azure-saas/.github/workflows/template-container-image-webhook.yml@main - secrets: - WEBHOOK_URL: ${{ secrets.ASDK_ADMIN_DEV_WEBHOOK_URL }} \ No newline at end of file + # webhook-dev: + # name: Image Build Webhook - Dev + # needs: build-image + # if: needs.build-image.result == 'success' + # uses: Azure/azure-saas/.github/workflows/template-container-image-webhook.yml@main + # secrets: + # WEBHOOK_URL: ${{ secrets.ASDK_ADMIN_DEV_WEBHOOK_URL }} \ No newline at end of file diff --git a/.github/workflows/container-image-build-saas-application-tag.yml b/.github/workflows/container-image-build-saas-application-tag.yml index f76c22a9..0c5f6b4d 100644 --- a/.github/workflows/container-image-build-saas-application-tag.yml +++ b/.github/workflows/container-image-build-saas-application-tag.yml @@ -14,11 +14,10 @@ jobs: tag_name: ${GITHUB_REF/refs\/tags\//} # Add webhook jobs below here for each environment you want to automatically update - webhook-dev: - name: Image Build Webhook - Dev - runs-on: ubuntu-latest - needs: build-image - if: needs.build-image.result == 'success' - uses: Azure/azure-saas/.github/workflows/template-container-image-webhook.yml@main - secrets: - WEBHOOK_URL: ${{ secrets.ASDK_WEB_DEV_WEBHOOK_URL }} \ No newline at end of file + # webhook-dev: + # name: Image Build Webhook - Dev + # needs: build-image + # if: needs.build-image.result == 'success' + # uses: Azure/azure-saas/.github/workflows/template-container-image-webhook.yml@main + # secrets: + # WEBHOOK_URL: ${{ secrets.ASDK_WEB_DEV_WEBHOOK_URL }} \ No newline at end of file diff --git a/.github/workflows/container-image-build-saas-permissions-tag.yml b/.github/workflows/container-image-build-saas-permissions-tag.yml index 32eb8c07..822f8e27 100644 --- a/.github/workflows/container-image-build-saas-permissions-tag.yml +++ b/.github/workflows/container-image-build-saas-permissions-tag.yml @@ -14,10 +14,10 @@ jobs: tag_name: ${GITHUB_REF/refs\/tags\//} # Add webhook jobs below here for each environment you want to automatically update - webhook-dev: - name: Image Build Webhook - Dev - needs: build-image - if: needs.build-image.result == 'success' - uses: Azure/azure-saas/.github/workflows/template-container-image-webhook.yml@main - secrets: - WEBHOOK_URL: ${{ secrets.ASDK_PERMISSIONS_DEV_WEBHOOK_URL }} \ No newline at end of file + # webhook-dev: + # name: Image Build Webhook - Dev + # needs: build-image + # if: needs.build-image.result == 'success' + # uses: Azure/azure-saas/.github/workflows/template-container-image-webhook.yml@main + # secrets: + # WEBHOOK_URL: ${{ secrets.ASDK_PERMISSIONS_DEV_WEBHOOK_URL }} \ No newline at end of file diff --git a/.github/workflows/container-image-build-saas-signupadministration-tag.yml b/.github/workflows/container-image-build-saas-signupadministration-tag.yml index 1bb9de22..92a9cdc8 100644 --- a/.github/workflows/container-image-build-saas-signupadministration-tag.yml +++ b/.github/workflows/container-image-build-saas-signupadministration-tag.yml @@ -14,10 +14,10 @@ jobs: tag_name: ${GITHUB_REF/refs\/tags\//} # Add webhook jobs below here for each environment you want to automatically update - webhook-dev: - name: Image Build Webhook - Dev - needs: build-image - if: needs.build-image.result == 'success' - uses: Azure/azure-saas/.github/workflows/template-container-image-webhook.yml@main - secrets: - WEBHOOK_URL: ${{ secrets.ASDK_SIGNUP_DEV_WEBHOOK_URL }} \ No newline at end of file + # webhook-dev: + # name: Image Build Webhook - Dev + # needs: build-image + # if: needs.build-image.result == 'success' + # uses: Azure/azure-saas/.github/workflows/template-container-image-webhook.yml@main + # secrets: + # WEBHOOK_URL: ${{ secrets.ASDK_SIGNUP_DEV_WEBHOOK_URL }} \ No newline at end of file diff --git a/.github/workflows/template-container-image-build.yml b/.github/workflows/template-container-image-build.yml index 962b5505..fa0336a7 100644 --- a/.github/workflows/template-container-image-build.yml +++ b/.github/workflows/template-container-image-build.yml @@ -11,6 +11,11 @@ on: required: false type: boolean default: false + # Change this input if you'd like to publish the containers to a repository other than github packages. + image_repository: + required: false + type: string + default: ghcr.io/${{ github.repository }} name: Container Image Publishing - Build @@ -22,6 +27,7 @@ jobs: - name: Code Checkout uses: actions/checkout@v2 + # Replace this login step if you use a container repository other than github packages. - name: Log in to Registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin @@ -31,23 +37,23 @@ jobs: - name: Create Tag run: | - GH_IMAGE_PATH="ghcr.io/${{ github.repository }}/${{ inputs.image_to_push }}" - GH_TAG=$GH_IMAGE_PATH:${{ inputs.tag_name }} + IMAGE_PATH="${{inputs.image_repository}}/${{ inputs.image_to_push }}" + IMAGE_TAG=$IMAGE_PATH:${{ inputs.tag_name }} # Make characters lowercase - GH_TAG=$(echo $GH_TAG | tr '[:upper:]' '[:lower:]') - echo "Tagging ${{ inputs.image_to_push }} with $GH_TAG in GitHub Container Registry" - docker tag ${{ inputs.image_to_push }} $GH_TAG + IMAGE_TAG=$(echo $GH_TAG | tr '[:upper:]' '[:lower:]') + echo "Tagging ${{ inputs.image_to_push }} with $IMAGE_TAG in GitHub Container Registry" + docker tag ${{ inputs.image_to_push }} $IMAGE_TAG - name: Tag Latest if: ${{ inputs.tag_latest }} run: | - GH_TAG_LATEST=$GH_IMAGE_PATH:latest + IMAGE_TAG_LATEST=$IMAGE_PATH:latest # Make characters lowercase - GH_TAG_LATEST=$(echo $GH_TAG_LATEST | tr '[:upper:]' '[:lower:]') - echo "Tagging ${{ inputs.image_to_push }} with $GH_TAG_LATEST in GitHub Container Registry" - docker tag ${{ inputs.image_to_push }} $GH_TAG_LATEST + IMAGE_TAG_LATEST=$(echo $IMAGE_TAG_LATEST | tr '[:upper:]' '[:lower:]') + echo "Tagging ${{ inputs.image_to_push }} with $IMAGE_TAG_LATEST in GitHub Container Registry" + docker tag ${{ inputs.image_to_push }} $IMAGE_TAG_LATEST - name: Publish Image run: | echo "Pushing ${{ inputs.image_to_push }} to GitHub Container Registry" - docker push --all-tags $GH_IMAGE_PATH \ No newline at end of file + docker push --all-tags $IMAGE_PATH \ No newline at end of file