2022-05-03 20:01:37 +02:00
|
|
|
---
|
|
|
|
name: Release Desktop
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
release_type:
|
|
|
|
description: 'Release Options'
|
|
|
|
required: true
|
|
|
|
default: 'Initial Release'
|
|
|
|
type: choice
|
|
|
|
options:
|
|
|
|
- Initial Release
|
|
|
|
- Redeploy
|
|
|
|
- Dry Run
|
2022-07-15 15:29:56 +02:00
|
|
|
snap_publish:
|
|
|
|
description: 'Publish to snap store'
|
|
|
|
required: true
|
|
|
|
default: true
|
|
|
|
type: boolean
|
|
|
|
choco_publish:
|
|
|
|
description: 'Publish to chocolatey store'
|
|
|
|
required: true
|
|
|
|
default: true
|
|
|
|
type: boolean
|
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
setup:
|
|
|
|
name: Setup
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
outputs:
|
2022-06-02 20:14:17 +02:00
|
|
|
release-version: ${{ steps.version.outputs.version }}
|
2022-06-07 15:44:25 +02:00
|
|
|
release-channel: ${{ steps.release-channel.outputs.channel }}
|
2022-05-03 20:01:37 +02:00
|
|
|
steps:
|
2022-06-30 19:26:35 +02:00
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
- name: Branch check
|
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
|
|
|
run: |
|
2022-08-16 17:55:57 +02:00
|
|
|
if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ $GITHUB_REF != refs/heads/hotfix-rc-desktop ]]; then
|
2022-05-03 20:01:37 +02:00
|
|
|
echo "==================================="
|
2022-08-16 17:55:57 +02:00
|
|
|
echo "[!] Can only release from the 'rc' or 'hotfix-rc-desktop' branches"
|
2022-05-03 20:01:37 +02:00
|
|
|
echo "==================================="
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-06-01 19:03:05 +02:00
|
|
|
- name: Check Release Version
|
|
|
|
id: version
|
|
|
|
uses: bitwarden/gh-actions/release-version-check@ea9fab01d76940267b4147cc1c4542431246b9f6
|
|
|
|
with:
|
|
|
|
release-type: ${{ github.event.inputs.release_type }}
|
|
|
|
project-type: ts
|
|
|
|
file: apps/desktop/src/package.json
|
|
|
|
monorepo: true
|
|
|
|
monorepo-project: desktop
|
2022-05-03 20:01:37 +02:00
|
|
|
|
2022-06-07 15:44:25 +02:00
|
|
|
- name: Get Version Channel
|
|
|
|
id: release-channel
|
|
|
|
run: |
|
|
|
|
case "${{ steps.version.outputs.version }}" in
|
|
|
|
*"alpha"*)
|
|
|
|
echo "::set-output name=channel::alpha"
|
|
|
|
echo "[!] We do not yet support 'alpha'"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*"beta"*)
|
|
|
|
echo "::set-output name=channel::beta"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "::set-output name=channel::latest"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2022-07-25 23:20:17 +02:00
|
|
|
- name: Create GitHub deployment
|
|
|
|
uses: chrnorm/deployment-action@1b599fe41a0ef1f95191e7f2eec4743f2d7dfc48
|
|
|
|
id: deployment
|
|
|
|
with:
|
|
|
|
token: '${{ secrets.GITHUB_TOKEN }}'
|
2022-08-08 19:21:49 +02:00
|
|
|
initial-status: 'in_progress'
|
2022-07-25 23:20:17 +02:00
|
|
|
environment: 'Desktop - Production'
|
|
|
|
description: 'Deployment ${{ steps.version.outputs.version }} to channel ${{ steps.release-channel.outputs.channel }} from branch ${{ github.ref_name }}'
|
|
|
|
task: release
|
|
|
|
|
2022-05-24 16:42:17 +02:00
|
|
|
- name: Login to Azure
|
|
|
|
uses: Azure/login@ec3c14589bd3e9312b3cc8c41e6860e258df9010
|
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2022-09-05 11:39:27 +02:00
|
|
|
env:
|
|
|
|
KEYVAULT: bitwarden-prod-kv
|
|
|
|
SECRETS: |
|
|
|
|
aws-electron-access-id,
|
|
|
|
aws-electron-access-key,
|
|
|
|
aws-electron-bucket-name
|
|
|
|
run: |
|
|
|
|
for i in ${SECRETS//,/ }
|
|
|
|
do
|
|
|
|
VALUE=$(az keyvault secret show --vault-name $KEYVAULT --name $i --query value --output tsv)
|
|
|
|
echo "::add-mask::$VALUE"
|
|
|
|
echo "::set-output name=$i::$VALUE"
|
|
|
|
done
|
2022-05-24 16:42:17 +02:00
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
- name: Download all artifacts
|
2022-07-01 17:44:20 +02:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
2022-05-03 20:01:37 +02:00
|
|
|
uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783
|
|
|
|
with:
|
2022-05-24 16:42:17 +02:00
|
|
|
workflow: build-desktop.yml
|
2022-05-03 20:01:37 +02:00
|
|
|
workflow_conclusion: success
|
2022-06-22 14:32:45 +02:00
|
|
|
branch: ${{ github.ref_name }}
|
2022-06-02 20:02:26 +02:00
|
|
|
path: apps/desktop/artifacts
|
2022-05-03 20:01:37 +02:00
|
|
|
|
2022-07-01 17:44:20 +02:00
|
|
|
- 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
|
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
- name: Rename .pkg to .pkg.archive
|
|
|
|
env:
|
2022-06-01 19:03:05 +02:00
|
|
|
PKG_VERSION: ${{ steps.version.outputs.version }}
|
2022-06-02 20:02:26 +02:00
|
|
|
working-directory: apps/desktop/artifacts
|
2022-05-03 20:01:37 +02:00
|
|
|
run: mv Bitwarden-${{ env.PKG_VERSION }}-universal.pkg Bitwarden-${{ env.PKG_VERSION }}-universal.pkg.archive
|
|
|
|
|
2022-05-24 16:42:17 +02:00
|
|
|
- name: Publish artifacts to S3
|
2022-07-01 17:44:20 +02:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
2022-05-24 16:42:17 +02:00
|
|
|
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 }}
|
|
|
|
AWS_DEFAULT_REGION: 'us-west-2'
|
|
|
|
AWS_S3_BUCKET_NAME: ${{ steps.retrieve-secrets.outputs.aws-electron-bucket-name }}
|
2022-06-02 20:02:26 +02:00
|
|
|
working-directory: apps/desktop/artifacts
|
2022-05-24 16:42:17 +02:00
|
|
|
run: |
|
|
|
|
aws s3 cp ./ $AWS_S3_BUCKET_NAME/desktop/ \
|
|
|
|
--acl "public-read" \
|
|
|
|
--recursive \
|
|
|
|
--quiet
|
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
- name: Create release
|
|
|
|
uses: ncipollo/release-action@95215a3cb6e6a1908b3c44e00b4fdb15548b1e09 # v2.8.5
|
2022-07-01 17:44:20 +02:00
|
|
|
if: ${{ steps.release-channel.outputs.channel == 'latest' && github.event.inputs.release_type != 'Dry Run' }}
|
2022-05-03 20:01:37 +02:00
|
|
|
env:
|
2022-06-01 19:03:05 +02:00
|
|
|
PKG_VERSION: ${{ steps.version.outputs.version }}
|
2022-06-07 15:44:25 +02:00
|
|
|
RELEASE_CHANNEL: ${{ steps.release-channel.outputs.channel }}
|
2022-05-03 20:01:37 +02:00
|
|
|
with:
|
2022-06-02 20:02:26 +02:00
|
|
|
artifacts: "apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-amd64.deb,
|
|
|
|
apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-x86_64.rpm,
|
|
|
|
apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-x64.freebsd,
|
|
|
|
apps/desktop/artifacts/bitwarden_${{ env.PKG_VERSION }}_amd64.snap,
|
|
|
|
apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-x86_64.AppImage,
|
|
|
|
apps/desktop/artifacts/Bitwarden-Portable-${{ env.PKG_VERSION }}.exe,
|
|
|
|
apps/desktop/artifacts/Bitwarden-Installer-${{ env.PKG_VERSION }}.exe,
|
|
|
|
apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-ia32-store.appx,
|
|
|
|
apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-ia32.appx,
|
2022-06-08 21:23:28 +02:00
|
|
|
apps/desktop/artifacts/bitwarden-${{ env.PKG_VERSION }}-ia32.nsis.7z,
|
2022-06-02 20:02:26 +02:00
|
|
|
apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-x64-store.appx,
|
|
|
|
apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-x64.appx,
|
2022-06-08 21:23:28 +02:00
|
|
|
apps/desktop/artifacts/bitwarden-${{ env.PKG_VERSION }}-x64.nsis.7z,
|
2022-06-02 20:02:26 +02:00
|
|
|
apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-arm64-store.appx,
|
|
|
|
apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-arm64.appx,
|
2022-06-08 21:23:28 +02:00
|
|
|
apps/desktop/artifacts/bitwarden-${{ env.PKG_VERSION }}-arm64.nsis.7z,
|
2022-06-02 20:02:26 +02:00
|
|
|
apps/desktop/artifacts/bitwarden.${{ env.PKG_VERSION }}.nupkg,
|
|
|
|
apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-universal-mac.zip,
|
|
|
|
apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-universal.dmg,
|
|
|
|
apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-universal.dmg.blockmap,
|
2022-06-07 15:44:25 +02:00
|
|
|
apps/desktop/artifacts/Bitwarden-${{ env.PKG_VERSION }}-universal.pkg.archive,
|
|
|
|
apps/desktop/artifacts/${{ env.RELEASE_CHANNEL }}.yml,
|
|
|
|
apps/desktop/artifacts/${{ env.RELEASE_CHANNEL }}-linux.yml,
|
|
|
|
apps/desktop/artifacts/${{ env.RELEASE_CHANNEL }}-mac.yml"
|
2022-05-03 20:01:37 +02:00
|
|
|
commit: ${{ github.sha }}
|
|
|
|
tag: desktop-v${{ env.PKG_VERSION }}
|
2022-06-02 20:02:26 +02:00
|
|
|
name: Desktop v${{ env.PKG_VERSION }}
|
2022-05-03 20:01:37 +02:00
|
|
|
body: "<insert release notes here>"
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
draft: true
|
|
|
|
|
2022-07-25 23:20:17 +02:00
|
|
|
- name: Update deployment status to Success
|
2022-08-08 19:21:49 +02:00
|
|
|
if: ${{ success() }}
|
2022-07-25 23:20:17 +02:00
|
|
|
uses: chrnorm/deployment-status@07b3930847f65e71c9c6802ff5a402f6dfb46b86
|
|
|
|
with:
|
|
|
|
token: '${{ secrets.GITHUB_TOKEN }}'
|
|
|
|
state: 'success'
|
|
|
|
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
|
|
|
|
|
|
|
|
- name: Update deployment status to Failure
|
2022-08-08 19:21:49 +02:00
|
|
|
if: ${{ failure() }}
|
2022-07-25 23:20:17 +02:00
|
|
|
uses: chrnorm/deployment-status@07b3930847f65e71c9c6802ff5a402f6dfb46b86
|
|
|
|
with:
|
|
|
|
token: '${{ secrets.GITHUB_TOKEN }}'
|
|
|
|
state: 'failure'
|
|
|
|
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
|
2022-06-07 15:44:25 +02:00
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
snap:
|
|
|
|
name: Deploy Snap
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
needs: setup
|
2022-07-15 15:29:56 +02:00
|
|
|
if: inputs.snap_publish
|
2022-05-03 20:01:37 +02:00
|
|
|
env:
|
2022-06-01 19:03:05 +02:00
|
|
|
_PKG_VERSION: ${{ needs.setup.outputs.release-version }}
|
2022-05-03 20:01:37 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout Repo
|
|
|
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
|
|
|
|
|
|
|
- name: Login to Azure
|
|
|
|
uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a
|
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2022-09-05 11:39:27 +02:00
|
|
|
env:
|
|
|
|
KEYVAULT: bitwarden-prod-kv
|
|
|
|
SECRETS: |
|
|
|
|
snapcraft-store-token
|
|
|
|
run: |
|
|
|
|
for i in ${SECRETS//,/ }
|
|
|
|
do
|
|
|
|
VALUE=$(az keyvault secret show --vault-name $KEYVAULT --name $i --query value --output tsv)
|
|
|
|
echo "::add-mask::$VALUE"
|
|
|
|
echo "::set-output name=$i::$VALUE"
|
|
|
|
done
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Install Snap
|
|
|
|
uses: samuelmeuli/action-snapcraft@10d7d0a84d9d86098b19f872257df314b0bd8e2d # v1.2.0
|
|
|
|
with:
|
|
|
|
snapcraft_token: ${{ steps.retrieve-secrets.outputs.snapcraft-store-token }}
|
|
|
|
|
|
|
|
- name: Setup
|
|
|
|
run: mkdir dist
|
2022-06-02 20:02:26 +02:00
|
|
|
working-directory: apps/desktop
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Download Snap artifact
|
2022-07-19 21:01:14 +02:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
2022-05-03 20:01:37 +02:00
|
|
|
uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783
|
|
|
|
with:
|
2022-05-24 16:42:17 +02:00
|
|
|
workflow: build-desktop.yml
|
2022-05-03 20:01:37 +02:00
|
|
|
workflow_conclusion: success
|
2022-06-22 14:32:45 +02:00
|
|
|
branch: ${{ github.ref_name }}
|
2022-05-03 20:01:37 +02:00
|
|
|
artifacts: bitwarden_${{ env._PKG_VERSION }}_amd64.snap
|
2022-06-02 20:02:26 +02:00
|
|
|
path: apps/desktop/dist
|
2022-05-03 20:01:37 +02:00
|
|
|
|
2022-07-19 21:01:14 +02:00
|
|
|
- name: Download Snap artifact
|
|
|
|
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
|
|
|
|
artifacts: bitwarden_${{ env._PKG_VERSION }}_amd64.snap
|
|
|
|
path: apps/desktop/dist
|
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
- name: Deploy to Snap Store
|
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
|
|
|
run: |
|
2022-06-02 20:02:26 +02:00
|
|
|
snapcraft upload bitwarden_${{ env._PKG_VERSION }}_amd64.snap --release stable
|
2022-05-03 20:01:37 +02:00
|
|
|
snapcraft logout
|
2022-06-02 20:02:26 +02:00
|
|
|
working-directory: apps/desktop/dist
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
choco:
|
|
|
|
name: Deploy Choco
|
|
|
|
runs-on: windows-2019
|
|
|
|
needs: setup
|
2022-07-15 15:29:56 +02:00
|
|
|
if: inputs.choco_publish
|
2022-05-03 20:01:37 +02:00
|
|
|
env:
|
2022-06-01 19:03:05 +02:00
|
|
|
_PKG_VERSION: ${{ needs.setup.outputs.release-version }}
|
2022-05-03 20:01:37 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout Repo
|
|
|
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
|
|
|
|
2022-07-01 17:44:20 +02:00
|
|
|
- name: Print Environment
|
|
|
|
run: |
|
|
|
|
dotnet --version
|
|
|
|
dotnet nuget --version
|
|
|
|
|
2022-06-30 18:32:03 +02:00
|
|
|
- name: Login to Azure
|
|
|
|
uses: Azure/login@24848bc889cfc0a8313c2b3e378ac0d625b9bc16
|
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2022-09-05 11:39:27 +02:00
|
|
|
env:
|
|
|
|
KEYVAULT: bitwarden-prod-kv
|
|
|
|
SECRETS: |
|
|
|
|
cli-choco-api-key
|
|
|
|
run: |
|
|
|
|
for i in ${SECRETS//,/ }
|
|
|
|
do
|
|
|
|
VALUE=$(az keyvault secret show --vault-name $KEYVAULT --name $i --query value --output tsv)
|
|
|
|
echo "::add-mask::$VALUE"
|
|
|
|
echo "::set-output name=$i::$VALUE"
|
|
|
|
done
|
2022-06-30 18:32:03 +02:00
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
- name: Setup Chocolatey
|
2022-07-01 17:44:20 +02:00
|
|
|
shell: pwsh
|
2022-05-03 20:01:37 +02:00
|
|
|
run: choco apikey --key $env:CHOCO_API_KEY --source https://push.chocolatey.org/
|
|
|
|
env:
|
2022-06-30 18:32:03 +02:00
|
|
|
CHOCO_API_KEY: ${{ steps.retrieve-secrets.outputs.cli-choco-api-key }}
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Make dist dir
|
|
|
|
shell: pwsh
|
|
|
|
run: New-Item -ItemType directory -Path ./dist
|
2022-06-02 20:02:26 +02:00
|
|
|
working-directory: apps/desktop
|
2022-05-03 20:01:37 +02:00
|
|
|
|
|
|
|
- name: Download choco artifact
|
2022-07-19 21:01:14 +02:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
2022-05-03 20:01:37 +02:00
|
|
|
uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783
|
|
|
|
with:
|
2022-05-24 16:42:17 +02:00
|
|
|
workflow: build-desktop.yml
|
2022-05-03 20:01:37 +02:00
|
|
|
workflow_conclusion: success
|
2022-06-22 14:32:45 +02:00
|
|
|
branch: ${{ github.ref_name }}
|
2022-05-03 20:01:37 +02:00
|
|
|
artifacts: bitwarden.${{ env._PKG_VERSION }}.nupkg
|
2022-06-02 20:02:26 +02:00
|
|
|
path: apps/desktop/dist
|
2022-05-03 20:01:37 +02:00
|
|
|
|
2022-07-19 21:01:14 +02:00
|
|
|
- name: Download choco artifact
|
|
|
|
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
|
|
|
|
artifacts: bitwarden.${{ env._PKG_VERSION }}.nupkg
|
|
|
|
path: apps/desktop/dist
|
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
- name: Push to Chocolatey
|
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
|
|
|
shell: pwsh
|
2022-06-02 20:02:26 +02:00
|
|
|
run: choco push
|
|
|
|
working-directory: apps/desktop/dist
|