From 219ef8d524fa3b3a5cb7ca16525f2e3eb18dbcd3 Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Mon, 5 Feb 2024 08:49:36 -0500 Subject: [PATCH] DEVOPS-1696 - Fix Version Bump workflow (#7774) --- .github/workflows/version-bump.yml | 84 +++++++++++++++++++++++++++--- 1 file changed, 76 insertions(+), 8 deletions(-) diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index 02e425d634..175c1a0e21 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -51,9 +51,18 @@ jobs: - name: Checkout Branch uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 with: - repository: bitwarden/clients ref: main + - name: Check if RC branch exists + if: ${{ inputs.cut_rc_branch == true }} + run: | + remote_rc_branch_check=$(git ls-remote --heads origin rc | wc -l) + if [[ "${remote_rc_branch_check}" -gt 0 ]]; then + echo "Remote RC branch exists." + echo "Please delete current RC branch before running again." + exit 1 + fi + - name: Import GPG key uses: crazy-max/ghaction-import-gpg@82a020f1f7f605c65dd2449b392a52c3fcfef7ef # v6.0.0 with: @@ -307,14 +316,73 @@ jobs: with: ref: main - - name: Check if RC branch exists + ### Browser + - name: Browser - Verify version has been updated + if: ${{ inputs.bump_browser == true }} + env: + NEW_VERSION: ${{ inputs.version_number }} run: | - remote_rc_branch_check=$(git ls-remote --heads origin rc | wc -l) - if [[ "${remote_rc_branch_check}" -gt 0 ]]; then - echo "Remote RC branch exists." - echo "Please delete current RC branch before running again." - exit 1 - fi + CURRENT_VERSION=$(cat package.json | jq -r '.version') + + # Wait for version to change. + while [[ "$NEW_VERSION" != "$CURRENT_VERSION" ]] + do + echo "Waiting for version to be updated..." + sleep 10 + git pull --force + done + working-directory: apps/browser + + ### CLI + - name: CLI - Verify version has been updated + if: ${{ inputs.bump_cli == true }} + env: + NEW_VERSION: ${{ inputs.version_number }} + run: | + CURRENT_VERSION=$(cat package.json | jq -r '.version') + + # Wait for version to change. + while [[ "$NEW_VERSION" != "$CURRENT_VERSION" ]] + do + echo "Waiting for version to be updated..." + sleep 10 + git pull --force + done + working-directory: apps/cli + + ### Desktop + - name: Desktop - Verify version has been updated + if: ${{ inputs.bump_desktop == true }} + env: + NEW_VERSION: ${{ inputs.version_number }} + run: | + CURRENT_VERSION=$(cat package.json | jq -r '.version') + + # Wait for version to change. + while [[ "$NEW_VERSION" != "$CURRENT_VERSION" ]] + do + echo "Waiting for version to be updated..." + sleep 10 + git pull --force + done + working-directory: apps/desktop + + ### Web + - name: Web - Verify version has been updated + if: ${{ inputs.bump_web == true }} + env: + NEW_VERSION: ${{ inputs.version_number }} + run: | + CURRENT_VERSION=$(cat package.json | jq -r '.version') + + # Wait for version to change. + while [[ "$NEW_VERSION" != "$CURRENT_VERSION" ]] + do + echo "Waiting for version to be updated..." + sleep 10 + git pull --force + done + working-directory: apps/web - name: Cut RC branch run: |