From 6a1e683a93e3a7532321865b563bd5978512b457 Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Thu, 16 Dec 2021 11:46:26 -0500 Subject: [PATCH] Update workflows (#1344) --- .github/workflows/build.yml | 55 +++++++++++++++--------------- .github/workflows/release.yml | 17 +++++---- .github/workflows/version-bump.yml | 2 +- 3 files changed, 38 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b5a2840eb1..4b79c13e5b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,8 +40,7 @@ jobs: - name: Get GitHub sha as version id: version - run: | - echo "::set-output name=value::${GITHUB_SHA:0:7}" + run: echo "::set-output name=value::${GITHUB_SHA:0:7}" build-oss-selfhost: @@ -170,7 +169,7 @@ jobs: echo "GitHub event: $GITHUB_EVENT" - name: Setup DCT - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/release' + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix' id: setup-dct uses: bitwarden/gh-actions/setup-docker-trust@a8c384a05a974c05c48374c818b004be221d43ff with: @@ -216,12 +215,12 @@ jobs: if: github.ref == 'refs/heads/master' run: docker tag bitwarden/web bitwarden/web:dev - - name: Tag release branch - if: github.ref == 'refs/heads/release' - run: docker tag bitwarden/web bitwarden/web:latest + - name: Tag hotfix branch + if: github.ref == 'refs/heads/hotfix' + run: docker tag bitwarden/web bitwarden/web:hotfix - name: List Docker images - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/release' + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix' run: docker images - name: Push rc image @@ -238,15 +237,15 @@ jobs: DOCKER_CONTENT_TRUST: 1 DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ steps.setup-dct.outputs.dct-delegate-repo-passphrase }} - - name: Push latest image - if: github.ref == 'refs/heads/release' - run: docker push bitwarden/web:latest + - name: Push hotfix image + if: github.ref == 'refs/heads/hotfix' + run: docker push bitwarden/web:hotfix env: DOCKER_CONTENT_TRUST: 1 DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ steps.setup-dct.outputs.dct-delegate-repo-passphrase }} - name: Log out of Docker - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/release' + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix' run: docker logout @@ -310,21 +309,21 @@ jobs: docker --version docker build -t bitwardenqa.azurecr.io/web . - - name: Get image tag - id: image-tag - run: | - IMAGE_TAG=$(echo "$GITHUB_REF" | awk '{split($0, a, "/"); print a[3];}') - TAG_EXTENSION=${{ github.event.inputs.custom_tag_extension }} + # - name: Get image tag + # id: image-tag + # run: | + # IMAGE_TAG=$(echo "$GITHUB_REF" | awk '{split($0, a, "/"); print a[3];}') + # TAG_EXTENSION=${{ github.event.inputs.custom_tag_extension }} - if [[ $TAG_EXTENSION ]]; then - IMAGE_TAG=$IMAGE_TAG-$TAG_EXTENSION - fi - echo "::set-output name=value::$IMAGE_TAG" + # if [[ $TAG_EXTENSION ]]; then + # IMAGE_TAG=$IMAGE_TAG-$TAG_EXTENSION + # fi + # echo "::set-output name=value::$IMAGE_TAG" - - name: Tag image - env: - IMAGE_TAG: ${{ steps.image-tag.outputs.value }} - run: docker tag bitwardenqa.azurecr.io/web "bitwardenqa.azurecr.io/web:$IMAGE_TAG" + # - name: Tag image + # env: + # IMAGE_TAG: ${{ steps.image-tag.outputs.value }} + # run: docker tag bitwardenqa.azurecr.io/web "bitwardenqa.azurecr.io/web:$IMAGE_TAG" - name: Tag dev if: github.ref == 'refs/heads/master' @@ -333,10 +332,10 @@ jobs: - name: List Docker images run: docker images - - name: Push image - env: - IMAGE_TAG: ${{ steps.image-tag.outputs.value }} - run: docker push "bitwardenqa.azurecr.io/web:$IMAGE_TAG" + # - name: Push image + # env: + # IMAGE_TAG: ${{ steps.image-tag.outputs.value }} + # run: docker push "bitwardenqa.azurecr.io/web:$IMAGE_TAG" - name: Push dev images if: github.ref == 'refs/heads/master' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a0ee09783a..91843d2577 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,6 +54,7 @@ jobs: runs-on: ubuntu-20.04 needs: setup env: + _BRANCH_NAME: ${{ needs.setup.outputs.branch-name }} _RELEASE_VERSION: ${{ needs.setup.outputs.release_version }} steps: - name: Print environment @@ -73,22 +74,24 @@ jobs: - name: Checkout repo uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f - - name: Pull latest selfhost Release image - run: docker pull bitwarden/web:latest + - name: Pull latest selfhost image + run: docker pull bitwarden/web:$_BRANCH_NAME - - name: Tag version + - name: Tag version and latest run: | - docker tag bitwarden/web:latest bitwarden/web:$_RELEASE_VERSION + docker tag bitwarden/web:$_BRANCH_NAME bitwarden/web:$_RELEASE_VERSION + docker tag bitwarden/web:$_BRANCH_NAME bitwarden/web:latest - name: List Docker images run: docker images - - name: Push images - run: | - docker push bitwarden/web:$_RELEASE_VERSION + - name: Push version and latest image env: DOCKER_CONTENT_TRUST: 1 DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ steps.setup-dct.outputs.dct-delegate-repo-passphrase }} + run: | + docker push bitwarden/web:$_RELEASE_VERSION + docker push bitwarden/web:latest - name: Log out of Docker run: docker logout diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index fcaefa64d9..e4071dae50 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -66,6 +66,6 @@ jobs: - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [X] Other - + ## Objective Automated version bump to ${{ github.event.inputs.version_number }}"