2022-10-06 15:54:37 +02:00
|
|
|
|
---
|
|
|
|
|
name: Staged Rollout Desktop
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
workflow_dispatch:
|
2022-10-11 16:46:36 +02:00
|
|
|
|
inputs:
|
|
|
|
|
rollout_percentage:
|
|
|
|
|
description: 'Staged Rollout Percentage'
|
|
|
|
|
required: true
|
|
|
|
|
default: '10'
|
|
|
|
|
type: string
|
2022-10-06 15:54:37 +02:00
|
|
|
|
|
|
|
|
|
defaults:
|
|
|
|
|
run:
|
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
|
|
jobs:
|
2022-10-11 16:46:36 +02:00
|
|
|
|
rollout:
|
|
|
|
|
name: Update Rollout Percentage
|
2022-10-06 15:54:37 +02:00
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
|
steps:
|
2022-10-11 16:46:36 +02:00
|
|
|
|
- name: Login to Azure
|
2023-05-09 18:38:11 +02:00
|
|
|
|
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7
|
2022-10-11 16:46:36 +02:00
|
|
|
|
with:
|
2023-04-11 18:37:58 +02:00
|
|
|
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
2022-10-11 16:46:36 +02:00
|
|
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
|
id: retrieve-secrets
|
2023-10-03 19:03:16 +02:00
|
|
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@f1125802b1ccae8c601d7c4f61ce39ea254b10c8
|
2022-10-11 16:46:36 +02:00
|
|
|
|
with:
|
2023-04-11 18:37:58 +02:00
|
|
|
|
keyvault: "bitwarden-ci"
|
2022-10-11 16:46:36 +02:00
|
|
|
|
secrets: "aws-electron-access-id,
|
|
|
|
|
aws-electron-access-key,
|
|
|
|
|
aws-electron-bucket-name,
|
|
|
|
|
r2-electron-access-id,
|
|
|
|
|
r2-electron-access-key,
|
|
|
|
|
r2-electron-bucket-name,
|
|
|
|
|
cf-prod-account"
|
|
|
|
|
|
|
|
|
|
- name: Download channel update info files from R2
|
|
|
|
|
env:
|
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ steps.retrieve-secrets.outputs.r2-electron-access-id }}
|
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ steps.retrieve-secrets.outputs.r2-electron-access-key }}
|
|
|
|
|
AWS_DEFAULT_REGION: 'us-east-1'
|
|
|
|
|
AWS_S3_BUCKET_NAME: ${{ steps.retrieve-secrets.outputs.r2-electron-bucket-name }}
|
|
|
|
|
CF_ACCOUNT: ${{ steps.retrieve-secrets.outputs.cf-prod-account }}
|
|
|
|
|
run: |
|
|
|
|
|
aws s3 cp $AWS_S3_BUCKET_NAME/desktop/latest.yml . \
|
|
|
|
|
--quiet \
|
|
|
|
|
--endpoint-url https://${CF_ACCOUNT}.r2.cloudflarestorage.com
|
|
|
|
|
aws s3 cp $AWS_S3_BUCKET_NAME/desktop/latest-linux.yml . \
|
|
|
|
|
--quiet \
|
|
|
|
|
--endpoint-url https://${CF_ACCOUNT}.r2.cloudflarestorage.com
|
|
|
|
|
aws s3 cp $AWS_S3_BUCKET_NAME/desktop/latest-mac.yml . \
|
|
|
|
|
--quiet \
|
|
|
|
|
--endpoint-url https://${CF_ACCOUNT}.r2.cloudflarestorage.com
|
|
|
|
|
|
|
|
|
|
- name: Check new rollout percentage
|
|
|
|
|
env:
|
|
|
|
|
NEW_PCT: ${{ github.event.inputs.rollout_percentage }}
|
|
|
|
|
run: |
|
|
|
|
|
CURRENT_PCT=$(sed -r -n "s/stagingPercentage:\s([0-9]+)/\1/p" latest.yml)
|
|
|
|
|
echo "Current percentage: ${CURRENT_PCT}"
|
|
|
|
|
echo "New percentage: ${NEW_PCT}"
|
|
|
|
|
echo
|
|
|
|
|
if [ "$NEW_PCT" -le "$CURRENT_PCT" ]; then
|
|
|
|
|
echo "New percentage (${NEW_PCT}) must be higher than current percentage (${CURRENT_PCT})!"
|
|
|
|
|
echo
|
|
|
|
|
echo "If you want to pull a staged release because it hasn’t gone well, you must increment the version \
|
|
|
|
|
number higher than your broken release. Because some of your users will be on the broken 1.0.1, \
|
2022-11-29 23:48:25 +01:00
|
|
|
|
releasing a new 1.0.1 would result in them staying on a broken version."
|
2022-10-11 16:46:36 +02:00
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
- name: Set staged rollout percentage
|
|
|
|
|
env:
|
|
|
|
|
ROLLOUT_PCT: ${{ github.event.inputs.rollout_percentage }}
|
|
|
|
|
run: |
|
|
|
|
|
sed -i -r "/stagingPercentage/s/[0-9]+/${ROLLOUT_PCT}/" latest.yml
|
|
|
|
|
sed -i -r "/stagingPercentage/s/[0-9]+/${ROLLOUT_PCT}/" latest-linux.yml
|
|
|
|
|
sed -i -r "/stagingPercentage/s/[0-9]+/${ROLLOUT_PCT}/" latest-mac.yml
|
|
|
|
|
|
|
|
|
|
- name: Publish channel update info files to S3
|
|
|
|
|
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 }}
|
|
|
|
|
run: |
|
2022-11-30 15:36:09 +01:00
|
|
|
|
aws s3 cp latest.yml $AWS_S3_BUCKET_NAME/desktop/ \
|
|
|
|
|
--acl "public-read"
|
|
|
|
|
|
|
|
|
|
aws s3 cp latest-linux.yml $AWS_S3_BUCKET_NAME/desktop/ \
|
|
|
|
|
--acl "public-read"
|
|
|
|
|
|
|
|
|
|
aws s3 cp latest-mac.yml $AWS_S3_BUCKET_NAME/desktop/ \
|
|
|
|
|
--acl "public-read"
|
2022-10-11 16:46:36 +02:00
|
|
|
|
|
|
|
|
|
- name: Publish channel update info files to R2
|
|
|
|
|
env:
|
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ steps.retrieve-secrets.outputs.r2-electron-access-id }}
|
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ steps.retrieve-secrets.outputs.r2-electron-access-key }}
|
|
|
|
|
AWS_DEFAULT_REGION: 'us-east-1'
|
|
|
|
|
AWS_S3_BUCKET_NAME: ${{ steps.retrieve-secrets.outputs.r2-electron-bucket-name }}
|
|
|
|
|
CF_ACCOUNT: ${{ steps.retrieve-secrets.outputs.cf-prod-account }}
|
|
|
|
|
run: |
|
2022-11-30 15:36:09 +01:00
|
|
|
|
aws s3 cp latest.yml $AWS_S3_BUCKET_NAME/desktop/ \
|
|
|
|
|
--endpoint-url https://${CF_ACCOUNT}.r2.cloudflarestorage.com
|
2023-04-11 18:37:58 +02:00
|
|
|
|
|
2022-11-30 15:36:09 +01:00
|
|
|
|
aws s3 cp latest-linux.yml $AWS_S3_BUCKET_NAME/desktop/ \
|
|
|
|
|
--endpoint-url https://${CF_ACCOUNT}.r2.cloudflarestorage.com
|
|
|
|
|
|
|
|
|
|
aws s3 cp latest-mac.yml $AWS_S3_BUCKET_NAME/desktop/ \
|
2022-10-11 16:46:36 +02:00
|
|
|
|
--endpoint-url https://${CF_ACCOUNT}.r2.cloudflarestorage.com
|