From 0795545fb8a418503d41484868b8b535aee521ee Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Wed, 23 Nov 2022 10:21:22 -0500 Subject: [PATCH] Update Unified Self-Host Build Workflow (#2432) --- .github/workflows/build-self-host.yml | 36 ++++++++++++--------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-self-host.yml b/.github/workflows/build-self-host.yml index cc27c48819..f5d88e7c41 100644 --- a/.github/workflows/build-self-host.yml +++ b/.github/workflows/build-self-host.yml @@ -56,14 +56,19 @@ jobs: push: true tags: bitwardenqa.azurecr.io/self-host:${{ steps.tag.outputs.image_tag }} + - name: Pull new image + env: + PROJECT_NAME: self-host + IMAGE_TAG: ${{ steps.tag.outputs.image_tag }} + run: docker pull bitwardenqa.azurecr.io/${PROJECT_NAME}:${IMAGE_TAG} + - name: Log out of Docker run: docker logout ########## DockerHub ########## - name: Login to Azure - Prod Subscription if: | - false - && (github.ref == 'refs/heads/master' || + (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc') uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf @@ -72,8 +77,7 @@ jobs: - name: Retrieve secrets if: | - false - && (github.ref == 'refs/heads/master' || + (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc') id: retrieve-secrets @@ -87,8 +91,7 @@ jobs: - name: Log into Docker if: | - false - && (github.ref == 'refs/heads/master' || + (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc') env: @@ -112,29 +115,22 @@ jobs: echo "DOCKER_CONTENT_TRUST=1" >> $GITHUB_ENV echo "DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE=$DCT_REPO_PASSPHRASE" >> $GITHUB_ENV - - name: Tag and Push RC to Docker Hub + - name: Tag and Push image to Docker Hub if: | - false - && (github.ref == 'refs/heads/master' || + (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc') env: PROJECT_NAME: self-host - REGISTRY: bitwarden + IMAGE_TAG: ${{ steps.tag.outputs.image_tag }} run: | - IMAGE_TAG=$(echo "${GITHUB_REF:11}" | sed "s#/#-#g") # slash safe branch name - if [[ "$IMAGE_TAG" == "master" ]]; then - IMAGE_TAG=dev - fi - - docker tag $PROJECT_NAME \ - $REGISTRY/$PROJECT_NAME:$IMAGE_TAG - docker push $REGISTRY/$PROJECT_NAME:$IMAGE_TAG + docker tag bitwardenqa.azurecr.io/${PROJECT_NAME}:${IMAGE_TAG} \ + bitwarden/${PROJECT_NAME}:${IMAGE_TAG} + docker push bitwarden/${PROJECT_NAME}:${IMAGE_TAG} - name: Log out of Docker and disable Docker Notary if: | - false - && (github.ref == 'refs/heads/master' || + (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc') run: |