From d6c100afeb21ed4eae3af72a1ff2d3372aace62d Mon Sep 17 00:00:00 2001 From: Joseph Flinn <58369717+joseph-flinn@users.noreply.github.com> Date: Tue, 9 Nov 2021 07:26:30 -0800 Subject: [PATCH] Moving the push of the MAS artifact to the build workflow to enable manual publishing from TestFlight (#1150) --- .github/workflows/build.yml | 39 ++++++++++++++++++++++++++++++----- .github/workflows/release.yml | 29 -------------------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 19a1bc6094..656afde590 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,8 @@ jobs: package_version: ${{ steps.retrieve-version.outputs.package_version }} build_number: ${{ steps.increment-version.outputs.build_number }} safari_ref: ${{ steps.safari-ref.outputs.safari_ref }} + rc_branch_exists: ${{ steps.branch-check.outputs.rc_branch_exists }} + hotfix_branch_exists: ${{ steps.branch-check.outputs.hotfix_branch_exists }} steps: - name: Checkout repo uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 @@ -62,6 +64,21 @@ jobs: echo "Setting Safari Extension ref to $SAFARI_REF" echo "::set-output name=safari_ref::$SAFARI_REF" + - 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 hotfix) ]]; then + echo "::set-output name=hotfix_branch_exists::1" + else + echo "::set-output name=hotfix_branch_exists::0" + fi + linux: name: Linux Build @@ -215,9 +232,6 @@ jobs: run: npm run lint - name: Build & Sign (dev) - run: | - npm run build - npm run pack:win env: ELECTRON_BUILDER_SIGN: 1 SIGNING_VAULT_URL: ${{ secrets.SIGNING_VAULT_URL }} @@ -225,6 +239,9 @@ jobs: SIGNING_TENANT_ID: ${{ secrets.SIGNING_TENANT_ID }} SIGNING_CLIENT_SECRET: ${{ secrets.SIGNING_CLIENT_SECRET }} SIGNING_CERT_NAME: ${{ secrets.SIGNING_CERT_NAME }} + run: | + npm run build + npm run pack:win - name: Rename appx files for store shell: pwsh @@ -640,11 +657,11 @@ jobs: run: ./scripts/safari-build.ps1 -copyonly - name: Build application (dist) - run: | - npm run pack:mac env: APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }} APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} + run: | + npm run pack:mac - name: Upload .zip artifact uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 @@ -841,6 +858,18 @@ jobs: path: ./dist/mas-universal/Bitwarden-${{ env._PACKAGE_VERSION }}-universal.pkg if-no-files-found: error + - name: Deploy to TestFlight + env: + APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }} + APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} + if: | + (github.ref == 'refs/heads/master' + && needs.setup.outputs.rc_branch_exists == 0 + && needs.setup.outputs.hotfix_branch_exists == 0) + || (github.ref == 'refs/heads/rc' && needs.setup.outputs.hotfix_branch_exists == 0) + || github.ref == 'refs/heads/hotfix' + run: npm run upload:mas + macos-package-dev: name: MacOS Package Dev Release Asset diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9e375223a9..97897d9d7d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -163,32 +163,3 @@ jobs: run: | cd dist choco push - - - macos: - name: Deploy MacOS - runs-on: macos-10.15 - needs: setup - env: - _PKG_VERSION: ${{ needs.setup.outputs.package_version }} - steps: - - name: Checkout repo - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - - name: Make target directory - run: mkdir -p dist/mas-universal - - - name: Download Mac artifact - uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783 - with: - workflow: build.yml - workflow_conclusion: success - branch: ${{ needs.setup.outputs.branch-name }} - artifacts: Bitwarden-${{ env._PKG_VERSION }}-universal.pkg - path: ./dist/mas-universal - - - name: Deploy to App Store - run: npm run upload:mas - env: - APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }} - APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}