From 99ccd62bcd4248e18aeb1c1017bc571f2e627e90 Mon Sep 17 00:00:00 2001 From: Joseph Flinn <58369717+joseph-flinn@users.noreply.github.com> Date: Fri, 22 Oct 2021 13:16:57 -0700 Subject: [PATCH] Release branch constraint on build (#1599) * adding in the release branch constraint to the build workflow for mobile * moving the branch check to a setup job --- .github/workflows/build.yml | 63 +++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index af6752407..cb45d3ff0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,9 +24,37 @@ jobs: run: cloc --vcs git --exclude-dir Resources,store,test,Properties --include-lang C#,XAML + setup: + name: Setup + runs-on: ubuntu-20.04 + outputs: + rc_branch_exists: ${{ steps.branch-check.outputs.rc_branch_exists }} + release_branch_exists: ${{ steps.branch-check.outputs.release_branch_exists }} + steps: + - name: Checkout repo + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + + - name: Check if special branches exist + id: branch-check + run: | + if [[ $(git ls-remote --heads origin rc) ]]; then + echo "::set-output name=rc_branch_exists::1" + else + echo "::set-output name=rc_branch_exists::0" + fi + + if [[ $(git ls-remote --heads origin release) ]]; then + echo "::set-output name=release_branch_exists::1" + else + echo "::set-output name=release_branch_exists::0" + fi + shell: bash + + android: name: Android runs-on: windows-2019 + needs: setup steps: - name: Set up MSBuild uses: microsoft/setup-msbuild@c26a08ba26249b81327e26f6ef381897b6a8754d # v1 @@ -148,20 +176,13 @@ jobs: path: ./com.x8bit.bitwarden.apk if-no-files-found: error - - name: Check if RC branch exists - id: rc-branch-check - run: | - if [[ $(git ls-remote --heads origin rc) ]]; then - echo "::set-output name=branch_exists::1" - else - echo "::set-output name=branch_exists::0" - fi - shell: bash - - name: Deploy to Play Store if: | - (github.ref == 'refs/heads/master' && steps.rc-branch-check.outputs.branch_exists == 0) - || github.ref == 'refs/heads/rc' + (github.ref == 'refs/heads/master' + && needs.setup.outputs.rc_branch_exists == 0 + && needs.setup.outputs.release_branch_exists == 0) + || (github.ref == 'refs/heads/rc' && needs.setup.outputs.release_branch_exists == 0) + || github.ref == 'refs/heads/release' run: | PUBLISHER_PATH="$GITHUB_WORKSPACE/store/google/Publisher/bin/Release/netcoreapp2.0/Publisher.dll" CREDS_PATH="$HOME/secrets/play_creds.json" @@ -332,6 +353,7 @@ jobs: ios: name: Apple iOS runs-on: macos-11 + needs: setup steps: - name: Print environment run: | @@ -448,20 +470,13 @@ jobs: path: ./bitwarden-export/Bitwarden.ipa if-no-files-found: error - - name: Check if RC branch exists - id: rc-branch-check - run: | - if [[ $(git ls-remote --heads origin rc) ]]; then - echo "::set-output name=branch_exists::1" - else - echo "::set-output name=branch_exists::0" - fi - shell: bash - - name: Deploy to App Store if: | - (github.ref == 'refs/heads/master' && steps.rc-branch-check.outputs.branch_exists == 0) - || github.ref == 'refs/heads/rc' + (github.ref == 'refs/heads/master' + && needs.setup.outputs.rc_branch_exists == 0 + && needs.setup.outputs.release_branch_exists == 0) + || (github.ref == 'refs/heads/rc' && needs.setup.outputs.release_branch_exists == 0) + || github.ref == 'refs/heads/release' env: APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }} APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}