From 7033fa17da179df786489c95cf465862a93988ff Mon Sep 17 00:00:00 2001 From: Micaiah Martin <77340197+mimartin12@users.noreply.github.com> Date: Fri, 25 Feb 2022 08:12:07 -0600 Subject: [PATCH] Added dry run logic for release workflow (#495) --- .github/workflows/release.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ad4fba3797..789945a719 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,7 @@ on: options: - Initial Release - Redeploy + - Dry Run jobs: setup: @@ -22,6 +23,7 @@ jobs: branch-name: ${{ steps.branch.outputs.branch-name }} steps: - name: Branch check + if: ${{ github.event.inputs.release_type != 'Dry Run' }} run: | if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix" ]]; then echo "===================================" @@ -31,7 +33,7 @@ jobs: fi - name: Checkout repo - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # 2.3.4 + uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # 2.4.0 - name: Retrieve CLI release version id: retrieve-version @@ -69,7 +71,8 @@ jobs: branch: ${{ steps.branch.outputs.branch-name }} - name: Create release - uses: ncipollo/release-action@95215a3cb6e6a1908b3c44e00b4fdb15548b1e09 # v2.8.5 + if: ${{ github.event.inputs.release_type != 'Dry Run' }} + uses: ncipollo/release-action@40bb172bd05f266cf9ba4ff965cb61e9ee5f6d01 # v1.9.0 env: PKG_VERSION: ${{ steps.retrieve-version.outputs.package_version }} with: @@ -98,16 +101,16 @@ jobs: _PKG_VERSION: ${{ needs.setup.outputs.package_version }} steps: - name: Checkout repo - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0 - name: Login to Azure - uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a + uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf with: creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }} - name: Retrieve secrets id: retrieve-secrets - uses: Azure/get-keyvault-secrets@80ccd3fafe5662407cc2e55f202ee34bfff8c403 + uses: Azure/get-keyvault-secrets@b5c723b9ac7870c022b8c35befe620b7009b336f with: keyvault: "bitwarden-prod-kv" secrets: "snapcraft-store-token" @@ -126,6 +129,7 @@ jobs: artifacts: bw_${{ env._PKG_VERSION }}_amd64.snap - name: Publish Snap & logout + if: ${{ github.event.inputs.release_type != 'Dry Run' }} run: | snapcraft push bw_${{ env._PKG_VERSION }}_amd64.snap --release stable snapcraft logout @@ -139,7 +143,7 @@ jobs: _PKG_VERSION: ${{ needs.setup.outputs.package_version }} steps: - name: Checkout repo - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0 - name: Setup Chocolatey run: choco apikey --key $env:CHOCO_API_KEY --source https://push.chocolatey.org/ @@ -160,6 +164,7 @@ jobs: path: ./dist - name: Push to Chocolatey + if: ${{ github.event.inputs.release_type != 'Dry Run' }} shell: pwsh run: | cd dist @@ -174,7 +179,7 @@ jobs: _PKG_VERSION: ${{ needs.setup.outputs.package_version }} steps: - name: Checkout repo - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0 - name: Download artifacts uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783 @@ -186,8 +191,7 @@ jobs: path: build - name: Setup NPM - run: | - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc + run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} @@ -195,4 +199,5 @@ jobs: run: npm install -g husky - name: Publish NPM + if: ${{ github.event.inputs.release_type != 'Dry Run' }} run: npm publish --access public