Enable beta channel desktop release (#3161)

* Fix name

* Fix version reference

* Add release version bump to every job

* Fix release channel name

* Setup git branch

* Change branch name

* Fix name

* Fix download artifact

* Uncomment after testing

* Removed jslib

* Fix comments
This commit is contained in:
Michał Chęciński 2022-07-30 00:35:47 +02:00 committed by GitHub
parent a22ef4d36c
commit 8820a42ec9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 98 additions and 33 deletions

View File

@ -19,18 +19,19 @@ jobs:
outputs: outputs:
release-version: ${{ steps.version.outputs.version }} release-version: ${{ steps.version.outputs.version }}
release-channel: ${{ steps.release-channel.outputs.channel }} release-channel: ${{ steps.release-channel.outputs.channel }}
branch-name: ${{ steps.branch.outputs.branch-name }}
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
# - name: Branch check - name: Branch check
# run: | run: |
# if [[ "$GITHUB_REF" != "refs/heads/master" ]] && [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ $GITHUB_REF != "refs/heads/hotfix-rc" ]]; then if [[ "$GITHUB_REF" != "refs/heads/master" ]] && [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ $GITHUB_REF != "refs/heads/hotfix-rc" ]]; then
# echo "===================================" echo "==================================="
# echo "[!] Can only release from the 'master', 'rc' or 'hotfix-rc' branches" echo "[!] Can only release from the 'master', 'rc' or 'hotfix-rc' branches"
# echo "===================================" echo "==================================="
# exit 1 exit 1
# fi fi
- name: Bump Desktop Version - Root - name: Bump Desktop Version - Root
env: env:
@ -70,18 +71,45 @@ jobs:
;; ;;
esac esac
- name: Setup git config
run: |
git config --global user.name "GitHub Action Bot"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global url."https://github.com/".insteadOf ssh://git@github.com/
git config --global url."https://".insteadOf ssh://
- name: Create desktop-beta-release branch
id: branch
env:
VERSION: ${{ github.event.inputs.version_number }}
run: |
find="."
replace="_"
ver=${VERSION//$find/$replace}
branch_name=desktop-beta-release-$ver-beta
git switch -c $branch_name
git add .
git commit -m "Bump desktop version to $VERSION-beta"
git push -u origin $branch_name
echo "::set-output name=branch-name::$branch_name"
linux: linux:
name: Linux Build name: Linux Build
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: setup needs: setup
env: env:
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} _PACKAGE_VERSION: ${{ needs.setup.outputs.release-version }}
defaults: defaults:
run: run:
working-directory: apps/desktop working-directory: apps/desktop
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
with:
ref: ${{ needs.setup.outputs.branch-name }}
- name: Set up Node - name: Set up Node
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0 uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0
@ -158,8 +186,8 @@ jobs:
- name: Upload auto-update artifact - name: Upload auto-update artifact
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with: with:
name: ${{ needs.setup.outputs.release_channel }}-linux.yml name: ${{ needs.setup.outputs.release-channel }}-linux.yml
path: apps/desktop/dist/${{ needs.setup.outputs.release_channel }}-linux.yml path: apps/desktop/dist/${{ needs.setup.outputs.release-channel }}-linux.yml
if-no-files-found: error if-no-files-found: error
@ -172,10 +200,12 @@ jobs:
shell: pwsh shell: pwsh
working-directory: apps/desktop working-directory: apps/desktop
env: env:
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} _PACKAGE_VERSION: ${{ needs.setup.outputs.release-version }}
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
with:
ref: ${{ needs.setup.outputs.branch-name }}
- name: Set up Node - name: Set up Node
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0 uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0
@ -352,8 +382,8 @@ jobs:
- name: Upload auto-update artifact - name: Upload auto-update artifact
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with: with:
name: ${{ needs.setup.outputs.release_channel }}.yml name: ${{ needs.setup.outputs.release-channel }}.yml
path: apps/desktop/dist/nsis-web/${{ needs.setup.outputs.release_channel }}.yml path: apps/desktop/dist/nsis-web/${{ needs.setup.outputs.release-channel }}.yml
if-no-files-found: error if-no-files-found: error
@ -362,13 +392,15 @@ jobs:
runs-on: macos-11 runs-on: macos-11
needs: setup needs: setup
env: env:
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} _PACKAGE_VERSION: ${{ needs.setup.outputs.release-version }}
defaults: defaults:
run: run:
working-directory: apps/desktop working-directory: apps/desktop
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
with:
ref: ${{ needs.setup.outputs.branch-name }}
- name: Set up Node - name: Set up Node
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0 uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0
@ -489,13 +521,15 @@ jobs:
- setup - setup
- macos-build - macos-build
env: env:
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} _PACKAGE_VERSION: ${{ needs.setup.outputs.release-version }}
defaults: defaults:
run: run:
working-directory: apps/desktop working-directory: apps/desktop
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
with:
ref: ${{ needs.setup.outputs.branch-name }}
- name: Set up Node - name: Set up Node
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0 uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0
@ -677,8 +711,8 @@ jobs:
- name: Upload auto-update artifact - name: Upload auto-update artifact
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with: with:
name: ${{ needs.setup.outputs.release_channel }}-mac.yml name: ${{ needs.setup.outputs.release-channel }}-mac.yml
path: apps/desktop/dist/${{ needs.setup.outputs.release_channel }}-mac.yml path: apps/desktop/dist/${{ needs.setup.outputs.release-channel }}-mac.yml
if-no-files-found: error if-no-files-found: error
@ -689,13 +723,15 @@ jobs:
- setup - setup
- macos-build - macos-build
env: env:
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} _PACKAGE_VERSION: ${{ needs.setup.outputs.release-version }}
defaults: defaults:
run: run:
working-directory: apps/desktop working-directory: apps/desktop
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
with:
ref: ${{ needs.setup.outputs.branch-name }}
- name: Set up Node - name: Set up Node
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0 uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0
@ -861,7 +897,7 @@ jobs:
if-no-files-found: error if-no-files-found: error
release: release:
name: MacOS Package Prod Release Asset name: Release beta channel to S3
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: needs:
- setup - setup
@ -884,7 +920,7 @@ jobs:
secrets: "aws-electron-access-id, aws-electron-access-key, aws-electron-bucket-name" secrets: "aws-electron-access-id, aws-electron-access-key, aws-electron-bucket-name"
- name: Download all artifacts - name: Download all artifacts
uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783 uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # v3.0.0
with: with:
path: apps/desktop/artifacts path: apps/desktop/artifacts
@ -894,15 +930,44 @@ jobs:
working-directory: apps/desktop/artifacts working-directory: apps/desktop/artifacts
run: mv Bitwarden-${{ env.PKG_VERSION }}-universal.pkg Bitwarden-${{ env.PKG_VERSION }}-universal.pkg.archive run: mv Bitwarden-${{ env.PKG_VERSION }}-universal.pkg Bitwarden-${{ env.PKG_VERSION }}-universal.pkg.archive
# - name: Publish artifacts to S3 - name: Publish artifacts to S3
# env: env:
# AWS_ACCESS_KEY_ID: ${{ steps.retrieve-secrets.outputs.aws-electron-access-id }} AWS_ACCESS_KEY_ID: ${{ steps.retrieve-secrets.outputs.aws-electron-access-id }}
# AWS_SECRET_ACCESS_KEY: ${{ steps.retrieve-secrets.outputs.aws-electron-access-key }} AWS_SECRET_ACCESS_KEY: ${{ steps.retrieve-secrets.outputs.aws-electron-access-key }}
# AWS_DEFAULT_REGION: 'us-west-2' AWS_DEFAULT_REGION: 'us-west-2'
# AWS_S3_BUCKET_NAME: ${{ steps.retrieve-secrets.outputs.aws-electron-bucket-name }} AWS_S3_BUCKET_NAME: ${{ steps.retrieve-secrets.outputs.aws-electron-bucket-name }}
# working-directory: apps/desktop/artifacts working-directory: apps/desktop/artifacts
# run: | run: |
# aws s3 cp ./ $AWS_S3_BUCKET_NAME/desktop/ \ aws s3 cp ./ $AWS_S3_BUCKET_NAME/desktop/ \
# --acl "public-read" \ --acl "public-read" \
# --recursive \ --recursive \
# --quiet --quiet
remove-branch:
name: Remove branch
runs-on: ubuntu-20.04
if: always()
needs:
- setup
- linux
- windows
- macos-build
- macos-package-github
- macos-package-mas
- release
steps:
- name: Checkout repo
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
- name: Setup git config
run: |
git config --global user.name "GitHub Action Bot"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global url."https://github.com/".insteadOf ssh://git@github.com/
git config --global url."https://".insteadOf ssh://
- name: Remove branch
env:
BRANCH: ${{ needs.setup.outputs.branch-name }}
run: git push origin --delete $BRANCH