From 8fb1fc41b291d9d936ee495ba1a8858bd7a29ba5 Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Wed, 22 Jun 2022 08:32:45 -0400 Subject: [PATCH] Update workflows (#2945) --- .github/workflows/chromatic.yml | 5 +++- .github/workflows/release-browser.yml | 9 +------ .github/workflows/release-cli.yml | 16 ++++------- .github/workflows/release-desktop.yml | 13 +++------ .github/workflows/release-web.yml | 39 +++++++++++++++------------ 5 files changed, 35 insertions(+), 47 deletions(-) diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml index 7983a1ad90..ee348e5701 100644 --- a/.github/workflows/chromatic.yml +++ b/.github/workflows/chromatic.yml @@ -1,7 +1,10 @@ --- name: Chromatic -on: push +on: + push: + paths-ignore: + - '.github/workflows/**' jobs: chromatic: diff --git a/.github/workflows/release-browser.yml b/.github/workflows/release-browser.yml index e85b9dbf74..671d1b4b79 100644 --- a/.github/workflows/release-browser.yml +++ b/.github/workflows/release-browser.yml @@ -24,7 +24,6 @@ jobs: runs-on: ubuntu-20.04 outputs: release-version: ${{ steps.version.outputs.version }} - branch-name: ${{ steps.branch.outputs.branch-name }} steps: - name: Branch check if: ${{ github.event.inputs.release_type != 'Dry Run' }} @@ -49,12 +48,6 @@ jobs: monorepo: true monorepo-project: browser - - name: Get branch name - id: branch - run: | - BRANCH_NAME=$(basename ${{ github.ref }}) - echo "::set-output name=branch-name::$BRANCH_NAME" - locales-test: name: Locales Test @@ -102,7 +95,7 @@ jobs: with: workflow: build-browser.yml workflow_conclusion: success - branch: ${{ needs.setup.outputs.branch-name }} + branch: ${{ github.ref_name }} artifacts: 'browser-source-*.zip, dist-chrome-*.zip, dist-opera-*.zip, diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index 6ab350c8ce..c6a57eae2a 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -24,7 +24,6 @@ jobs: runs-on: ubuntu-20.04 outputs: release-version: ${{ steps.version.outputs.version }} - branch-name: ${{ steps.branch.outputs.branch-name }} steps: - name: Branch check if: ${{ github.event.inputs.release_type != 'Dry Run' }} @@ -49,21 +48,16 @@ jobs: monorepo: true monorepo-project: cli - - name: Get branch name - id: branch - run: | - BRANCH_NAME=$(basename ${{ github.ref }}) - echo "::set-output name=branch-name::$BRANCH_NAME" - - name: Download all artifacts uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8 with: workflow: build-cli.yml path: apps/cli workflow_conclusion: success - branch: ${{ steps.branch.outputs.branch-name }} + branch: ${{ github.ref_name }} - name: Create release + if: ${{ github.event.inputs.release_type != 'Dry Run' }} uses: ncipollo/release-action@58ae73b360456532aafd58ee170c045abbeaee37 # v1.10.0 env: PKG_VERSION: ${{ steps.version.outputs.version }} @@ -118,7 +112,7 @@ jobs: workflow: build-cli.yml path: apps/cli workflow_conclusion: success - branch: ${{ needs.setup.outputs.branch-name }} + branch: ${{ github.ref_name }} artifacts: bw_${{ env._PKG_VERSION }}_amd64.snap - name: Publish Snap & logout @@ -153,7 +147,7 @@ jobs: workflow: build-cli.yml path: apps/cli workflow_conclusion: success - branch: ${{ needs.setup.outputs.branch-name }} + branch: ${{ github.ref_name }} artifacts: bitwarden-cli.${{ env._PKG_VERSION }}.nupkg - name: Push to Chocolatey @@ -180,7 +174,7 @@ jobs: workflow: build-cli.yml path: apps/cli workflow_conclusion: success - branch: ${{ needs.setup.outputs.branch-name }} + branch: ${{ github.ref_name }} artifacts: bitwarden-cli-${{ env._PKG_VERSION }}-npm-build.zip - name: Setup NPM diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml index 8fc8a05177..4d2c7fc713 100644 --- a/.github/workflows/release-desktop.yml +++ b/.github/workflows/release-desktop.yml @@ -24,7 +24,6 @@ jobs: outputs: release-version: ${{ steps.version.outputs.version }} release-channel: ${{ steps.release-channel.outputs.channel }} - branch-name: ${{ steps.branch.outputs.branch-name }} steps: - name: Branch check if: ${{ github.event.inputs.release_type != 'Dry Run' }} @@ -66,12 +65,6 @@ jobs: ;; esac - - name: Get branch name - id: branch - run: | - BRANCH_NAME=$(basename ${{ github.ref }}) - echo "::set-output name=branch-name::$BRANCH_NAME" - - name: Login to Azure uses: Azure/login@ec3c14589bd3e9312b3cc8c41e6860e258df9010 with: @@ -89,7 +82,7 @@ jobs: with: workflow: build-desktop.yml workflow_conclusion: success - branch: ${{ steps.branch.outputs.branch-name }} + branch: ${{ github.ref_name }} path: apps/desktop/artifacts - name: Rename .pkg to .pkg.archive @@ -186,7 +179,7 @@ jobs: with: workflow: build-desktop.yml workflow_conclusion: success - branch: ${{ needs.setup.outputs.branch-name }} + branch: ${{ github.ref_name }} artifacts: bitwarden_${{ env._PKG_VERSION }}_amd64.snap path: apps/desktop/dist @@ -222,7 +215,7 @@ jobs: with: workflow: build-desktop.yml workflow_conclusion: success - branch: ${{ needs.setup.outputs.branch-name }} + branch: ${{ github.ref_name }} artifacts: bitwarden.${{ env._PKG_VERSION }}.nupkg path: apps/desktop/dist diff --git a/.github/workflows/release-web.yml b/.github/workflows/release-web.yml index 0468aeab67..72dfadf232 100644 --- a/.github/workflows/release-web.yml +++ b/.github/workflows/release-web.yml @@ -21,7 +21,6 @@ jobs: outputs: release_version: ${{ steps.version.outputs.version }} tag_version: ${{ steps.version.outputs.tag }} - branch_name: ${{ steps.branch.outputs.branch_name }} steps: - name: Branch check if: ${{ github.event.inputs.release_type != 'Dry Run' }} @@ -46,19 +45,13 @@ jobs: monorepo: true monorepo-project: web - - name: Get branch name - id: branch - run: | - BRANCH_NAME=$(basename ${{ github.ref }}) - echo "::set-output name=branch_name::$BRANCH_NAME" - self-host: name: Release self-host docker runs-on: ubuntu-20.04 needs: setup env: - _BRANCH_NAME: ${{ needs.setup.outputs.branch_name }} + _BRANCH_NAME: ${{ github.ref_name }} _RELEASE_VERSION: ${{ needs.setup.outputs.release_version }} _RELEASE_OPTION: ${{ github.event.inputs.release_type }} steps: @@ -91,8 +84,12 @@ jobs: - name: Docker Tag version and latest image run: | - docker tag bitwarden/web:$_BRANCH_NAME bitwarden/web:$_RELEASE_VERSION - docker tag bitwarden/web:$_BRANCH_NAME bitwarden/web:latest + if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then + docker tag bitwarden/web:latest bitwarden/web:$_RELEASE_VERSION + else + docker tag bitwarden/web:$_BRANCH_NAME bitwarden/web:$_RELEASE_VERSION + docker tag bitwarden/web:$_BRANCH_NAME bitwarden/web:latest + fi - name: Docker Push version and latest image if: ${{ github.event.inputs.release_type != 'Dry Run' }} @@ -121,11 +118,19 @@ jobs: env: REGISTRY: bitwardenqa.azurecr.io run: | - docker tag bitwarden/web:$_BRANCH_NAME $REGISTRY/web:$_RELEASE_VERSION - docker tag bitwarden/web:$_BRANCH_NAME $REGISTRY/web:latest + if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then + docker tag bitwarden/web:latest $REGISTRY/web:$_RELEASE_VERSION + docker tag bitwarden/web:latest $REGISTRY/web:latest - docker tag bitwarden/web:$_BRANCH_NAME $REGISTRY/web-sh:$_RELEASE_VERSION - docker tag bitwarden/web:$_BRANCH_NAME $REGISTRY/web-sh:latest + docker tag bitwarden/web:latest $REGISTRY/web-sh:$_RELEASE_VERSION + docker tag bitwarden/web:latest $REGISTRY/web-sh:latest + else + docker tag bitwarden/web:$_BRANCH_NAME $REGISTRY/web:$_RELEASE_VERSION + docker tag bitwarden/web:$_BRANCH_NAME $REGISTRY/web:latest + + docker tag bitwarden/web:$_BRANCH_NAME $REGISTRY/web-sh:$_RELEASE_VERSION + docker tag bitwarden/web:$_BRANCH_NAME $REGISTRY/web-sh:latest + fi - name: Push version and latest image if: ${{ github.event.inputs.release_type != 'Dry Run' }} @@ -161,7 +166,7 @@ jobs: workflow: build-web.yml path: apps/web workflow_conclusion: success - branch: ${{ needs.setup.outputs.branch_name }} + branch: ${{ github.ref_name }} artifacts: web-*-cloud-COMMERCIAL.zip # This should result in a build directory in the current working directory @@ -185,7 +190,7 @@ jobs: - name: Deploy CloudFlare Pages run: | rm -rf ./* - cp -R apps/web/build/* . + cp -R ../apps/web/build/* . working-directory: deployment - name: Create cf-pages-deploy branch @@ -222,7 +227,7 @@ jobs: workflow: build-web.yml path: apps/web/artifacts workflow_conclusion: success - branch: ${{ needs.setup.outputs.branch_name }} + branch: ${{ github.ref_name }} artifacts: "web-*-selfhosted-COMMERCIAL.zip, web-*-selfhosted-open-source.zip"