From 6bcde3a84cb216ad9b5f4e4f807e35300b6233c2 Mon Sep 17 00:00:00 2001 From: Joseph Flinn <58369717+joseph-flinn@users.noreply.github.com> Date: Fri, 1 Jul 2022 08:44:20 -0700 Subject: [PATCH] Fix Choco Release & Update Dry Run logic (#3017) * disabling snap for testing * adding in environment logging * adding in some Dry Run logic * adding more protected dry run logic * skipping long running steps for testing purposes * testing out windowws-2022 runner * Trying a different GitHub Action expression syntax * manually disabling jobs because I don't have time to figure out GitHub's weird syntax * updating nuget on windows-2019 * disabling the nuget version 6 * trying more GitHub Action syntax * disabling choco for testing * running test on Dry Run release * changing the double quotes to single quotes inside the GitHub Action expression * removing testing code * updating more dry run logic * reverting a branch name change --- .github/workflows/release-browser.yml | 16 +++++++++++++++- .github/workflows/release-cli.yml | 12 +++++++++++- .github/workflows/release-desktop.yml | 19 ++++++++++++++++++- .github/workflows/release-web.yml | 12 ++++++++++++ 4 files changed, 56 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-browser.yml b/.github/workflows/release-browser.yml index b18002f1d46..da8780599c9 100644 --- a/.github/workflows/release-browser.yml +++ b/.github/workflows/release-browser.yml @@ -90,7 +90,8 @@ jobs: - setup - locales-test steps: - - name: Download latest RC build artifacts + - name: Download latest Release build artifacts + if: ${{ github.event.inputs.release_type != 'Dry Run' }} uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8 with: workflow: build-browser.yml @@ -102,6 +103,19 @@ jobs: dist-firefox-*.zip, dist-edge-*.zip' + - name: Download latest master build artifacts + if: ${{ github.event.inputs.release_type == 'Dry Run' }} + uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8 + with: + workflow: build-browser.yml + workflow_conclusion: success + branch: master + artifacts: 'browser-source-*.zip, + dist-chrome-*.zip, + dist-opera-*.zip, + dist-firefox-*.zip, + dist-edge-*.zip' + - name: Rename build artifacts env: PACKAGE_VERSION: ${{ needs.setup.outputs.release-version }} diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index fe9b02f2a75..de2b279a25e 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -48,7 +48,8 @@ jobs: monorepo: true monorepo-project: cli - - name: Download all artifacts + - name: Download all Release artifacts + if: ${{ github.event.inputs.release_type != 'Dry Run' }} uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8 with: workflow: build-cli.yml @@ -56,6 +57,15 @@ jobs: workflow_conclusion: success branch: ${{ github.ref_name }} + - name: Download all artifacts + if: ${{ github.event.inputs.release_type == 'Dry Run' }} + uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8 + with: + workflow: build-cli.yml + path: apps/cli + workflow_conclusion: success + branch: master + - name: Create release if: ${{ github.event.inputs.release_type != 'Dry Run' }} uses: ncipollo/release-action@58ae73b360456532aafd58ee170c045abbeaee37 # v1.10.0 diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml index 189f6a59578..67bcab7a779 100644 --- a/.github/workflows/release-desktop.yml +++ b/.github/workflows/release-desktop.yml @@ -78,6 +78,7 @@ jobs: secrets: "aws-electron-access-id, aws-electron-access-key, aws-electron-bucket-name" - name: Download all artifacts + if: ${{ github.event.inputs.release_type != 'Dry Run' }} uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783 with: workflow: build-desktop.yml @@ -85,6 +86,15 @@ jobs: branch: ${{ github.ref_name }} path: apps/desktop/artifacts + - name: Download all artifacts + if: ${{ github.event.inputs.release_type == 'Dry Run' }} + uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783 + with: + workflow: build-desktop.yml + workflow_conclusion: success + branch: master + path: apps/desktop/artifacts + - name: Rename .pkg to .pkg.archive env: PKG_VERSION: ${{ steps.version.outputs.version }} @@ -92,6 +102,7 @@ jobs: run: mv Bitwarden-${{ env.PKG_VERSION }}-universal.pkg Bitwarden-${{ env.PKG_VERSION }}-universal.pkg.archive - name: Publish artifacts to S3 + if: ${{ github.event.inputs.release_type != 'Dry Run' }} env: AWS_ACCESS_KEY_ID: ${{ steps.retrieve-secrets.outputs.aws-electron-access-id }} AWS_SECRET_ACCESS_KEY: ${{ steps.retrieve-secrets.outputs.aws-electron-access-key }} @@ -106,7 +117,7 @@ jobs: - name: Create release uses: ncipollo/release-action@95215a3cb6e6a1908b3c44e00b4fdb15548b1e09 # v2.8.5 - if: ${{ steps.release-channel.outputs.channel }} == "latest" + if: ${{ steps.release-channel.outputs.channel == 'latest' && github.event.inputs.release_type != 'Dry Run' }} env: PKG_VERSION: ${{ steps.version.outputs.version }} RELEASE_CHANNEL: ${{ steps.release-channel.outputs.channel }} @@ -200,6 +211,11 @@ jobs: - name: Checkout Repo uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + - name: Print Environment + run: | + dotnet --version + dotnet nuget --version + - name: Login to Azure uses: Azure/login@24848bc889cfc0a8313c2b3e378ac0d625b9bc16 with: @@ -213,6 +229,7 @@ jobs: secrets: "cli-choco-api-key" - name: Setup Chocolatey + shell: pwsh run: choco apikey --key $env:CHOCO_API_KEY --source https://push.chocolatey.org/ env: CHOCO_API_KEY: ${{ steps.retrieve-secrets.outputs.cli-choco-api-key }} diff --git a/.github/workflows/release-web.yml b/.github/workflows/release-web.yml index 3dd5971c90e..33b711306b1 100644 --- a/.github/workflows/release-web.yml +++ b/.github/workflows/release-web.yml @@ -222,6 +222,7 @@ jobs: - cfpages-deploy steps: - name: Download latest build artifacts + if: ${{ github.event.inputs.release_type != 'Dry Run' }} uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8 with: workflow: build-web.yml @@ -231,6 +232,17 @@ jobs: artifacts: "web-*-selfhosted-COMMERCIAL.zip, web-*-selfhosted-open-source.zip" + - name: Download latest build artifacts + if: ${{ github.event.inputs.release_type == 'Dry Run' }} + uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8 + with: + workflow: build-web.yml + path: apps/web/artifacts + workflow_conclusion: success + branch: master + artifacts: "web-*-selfhosted-COMMERCIAL.zip, + web-*-selfhosted-open-source.zip" + - name: Rename assets working-directory: apps/web/artifacts run: |