mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-02 18:17:46 +01:00
DEVOPS-1683 Refactor deploy-web workflow (#7184)
* DEVOPS-1683 REFACTOR: Azure Storage Account Blob container sync * DEVOPS-1683 REFACTOR: deploy-non-prod-web.yml: Changed destination container to '$web' and added delete-destination flag * DEVOPS-1683 FIX: Source path in Azure Storage Blob sync * DEVOPS-1683 REFACTOR: deploy-non-prod-web.yml with tag input * DEVOPS-1683 REFACTOR: Add EUPROD environment configuration * DEVOPS-1683 DELETE: deploy workflow for EU-QA web * DEVOPS-1683 ADD: GitHub deployment and update deployment status * DEVOPS-1683 REFACTOR: Slack channel for devops alerts for testing purposes * DEVOPS-1683 ADD: environment variables to deploy-non-prod-web workflow * DEVOPS-1683 REFACTOR: environment URLs in deploy-non-prod-web.yml * DEVOPS-1683 DELETE: Deploy workflow for EU-PRD Cloud * DEVOPS-1683 REFACTOR: Update deployment process for non-prod web app * DEVOPS-1683 REFACTOR: deploy configuration for non-prod web environments * DEVOPS-1683 DELETE: environment-branch and cfpages-deploy from deploy-non-prod-web workflow * DEVOPS-1683 REFACTOR: deployment environment in deploy-non-prod-web.yml * DEVOPS-1683 DELETE: steps in deploy workflow for testing purposes * Revert "DEVOPS-1683 DELETE: steps in deploy workflow for testing purposes" This reverts commit5ad5802857
. * DEVOPS-1683 ADD: write permissions for deployments * DEVOPS-1683 REFACTOR: slack-channel in deploy-non-prod-web.yml * DEVOPS-1683 REFACTOR: deployment status to use dynamic values * DEVOPS-1683 REFACTOR: slack-channel in deploy-non-prod-web.yml * DEVOPS-1683 REFACTOR: project name in deployment workflow * DEVOPS-1683 ADD: Deploy task to non-prod web deployment workflow * DEVOPS-1683 ADD: Approval step for deployment * DEVOPS-1683 REFACTOR: Approval job for deployment to non-prod web environment * DEVOPS-1683 REFACTOR: branch reference in deploy workflow * DEVOPS-1683 REFACTOR: default branch name in deploy-non-prod-web.yml * DEVOPS-1683 ADD: notify-start job to deployment workflow * DEVOPS-1683 REFACTOR: deploy workflow name * DEVOPS-1683 Update default environment to USQA in deploy-non-prod-web.yml * Update .github/workflows/deploy-non-prod-web.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> * Update .github/workflows/deploy-non-prod-web.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> * Update .github/workflows/deploy-non-prod-web.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> * Update .github/workflows/deploy-non-prod-web.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> * Update .github/workflows/deploy-non-prod-web.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> * Update .github/workflows/deploy-non-prod-web.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> * Update .github/workflows/deploy-non-prod-web.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> * Update .github/workflows/deploy-non-prod-web.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> * Update .github/workflows/deploy-non-prod-web.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> * DEVOPS-1683 REFACTOR: Slack channel for non-prod deployment * DEVOPS-1683 REFACTOR: environment configuration for non-production web deployment * DEVOPS-1683 REFACTOR: job name for building web for missing branch * DEVOPS-1683 REFACTOR: notify-start dependencies need setup job * DEVOPS-1683 REFACTOR download and trigger steps in deploy-non-prod-web.yml * DEVOPS-1683 REFACTOR: branch name in deploy workflow * DEVOPS-1683 RENAME: deploy-non-prod-web.yml to deploy-web.yml * Revert "DEVOPS-1683 RENAME: deploy-non-prod-web.yml to deploy-web.yml" This reverts commit2ae5519fdc
. * DEVOPS-1683 REFACTOR: branch/tag references in deploy workflow * DEVOPS-1683 RENAME: deploy-non-prod-web.yml to deploy-web.yml * DEVOPS-1683 REFACTOR: branch-or-tag description * Revert "DEVOPS-1683 REFACTOR: branch-or-tag description" This reverts commita326a32bf3
. * Update .github/workflows/deploy-web.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> * Update .github/workflows/deploy-web.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> --------- Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com>
This commit is contained in:
parent
87b6651f8e
commit
139ba13f2a
60
.github/workflows/deploy-eu-prod-web.yml
vendored
60
.github/workflows/deploy-eu-prod-web.yml
vendored
@ -1,60 +0,0 @@
|
|||||||
---
|
|
||||||
name: Deploy Web to EU-PRD Cloud
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
tag:
|
|
||||||
description: "Branch name to deploy (examples: 'main', 'feature/sm')"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
default: main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
azure-deploy:
|
|
||||||
name: Deploy to Azure
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
env:
|
|
||||||
_WEB_ARTIFACT: "web-*-cloud-euprd.zip"
|
|
||||||
steps:
|
|
||||||
- name: Login to Azure - EU Subscription
|
|
||||||
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7
|
|
||||||
with:
|
|
||||||
creds: ${{ secrets.AZURE_KV_EU_PRD_SERVICE_PRINCIPAL }}
|
|
||||||
|
|
||||||
- name: Retrieve Storage Account connection string
|
|
||||||
id: retrieve-secrets
|
|
||||||
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
|
||||||
with:
|
|
||||||
keyvault: webvault-westeurope-prod
|
|
||||||
secrets: "sa-bitwarden-web-vault-dev-key-temp"
|
|
||||||
|
|
||||||
- name: Download latest cloud asset
|
|
||||||
uses: bitwarden/gh-actions/download-artifacts@main
|
|
||||||
with:
|
|
||||||
workflow: build-web.yml
|
|
||||||
path: apps/web
|
|
||||||
workflow_conclusion: success
|
|
||||||
branch: ${{ github.event.inputs.tag }}
|
|
||||||
artifacts: ${{ env._WEB_ARTIFACT }}
|
|
||||||
|
|
||||||
- name: Unzip build asset
|
|
||||||
working-directory: apps/web
|
|
||||||
run: unzip ${{ env._WEB_ARTIFACT }}
|
|
||||||
|
|
||||||
- name: Empty container in Storage Account
|
|
||||||
run: |
|
|
||||||
az storage blob delete-batch \
|
|
||||||
--source '$web' \
|
|
||||||
--pattern '*' \
|
|
||||||
--connection-string "${{ steps.retrieve-secrets.outputs.sa-bitwarden-web-vault-dev-key-temp }}"
|
|
||||||
|
|
||||||
- name: Deploy to Azure Storage Account
|
|
||||||
working-directory: apps/web
|
|
||||||
run: |
|
|
||||||
az storage blob upload-batch \
|
|
||||||
--source "./build" \
|
|
||||||
--destination '$web' \
|
|
||||||
--connection-string "${{ steps.retrieve-secrets.outputs.sa-bitwarden-web-vault-dev-key-temp }}" \
|
|
||||||
--overwrite \
|
|
||||||
--no-progress
|
|
91
.github/workflows/deploy-eu-qa-web.yml
vendored
91
.github/workflows/deploy-eu-qa-web.yml
vendored
@ -1,91 +0,0 @@
|
|||||||
---
|
|
||||||
name: Deploy Web to EU-QA Cloud
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
tag:
|
|
||||||
description: "Branch name to deploy (examples: 'main', 'feature/sm')"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
default: main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
notify-start:
|
|
||||||
name: Notify Slack with start message
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
if: always()
|
|
||||||
steps:
|
|
||||||
- uses: bitwarden/gh-actions/report-deployment-status-to-slack@main
|
|
||||||
with:
|
|
||||||
project: Web
|
|
||||||
environment: EU QA Cloud
|
|
||||||
tag: ${{ github.ref_name }}
|
|
||||||
slack-channel: team-eng-qa-devops
|
|
||||||
event: 'start'
|
|
||||||
url: https://github.com/bitwarden/clients/actions/runs/${{ github.run_id }}
|
|
||||||
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
|
||||||
|
|
||||||
azure-deploy:
|
|
||||||
name: Deploy to Azure
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
env:
|
|
||||||
_WEB_ARTIFACT: "web-*-cloud-euqa.zip"
|
|
||||||
steps:
|
|
||||||
- name: Login to Azure - EU Subscription
|
|
||||||
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7
|
|
||||||
with:
|
|
||||||
creds: ${{ secrets.AZURE_KV_EU_QA_SERVICE_PRINCIPAL }}
|
|
||||||
|
|
||||||
- name: Retrieve Storage Account connection string
|
|
||||||
id: retrieve-secrets
|
|
||||||
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
|
||||||
with:
|
|
||||||
keyvault: webvaulteu-westeurope-qa
|
|
||||||
secrets: "sa-bitwarden-web-vault-dev-key-temp"
|
|
||||||
|
|
||||||
- name: Download latest cloud asset
|
|
||||||
uses: bitwarden/gh-actions/download-artifacts@main
|
|
||||||
with:
|
|
||||||
workflow: build-web.yml
|
|
||||||
path: apps/web
|
|
||||||
workflow_conclusion: success
|
|
||||||
branch: ${{ github.event.inputs.tag }}
|
|
||||||
artifacts: ${{ env._WEB_ARTIFACT }}
|
|
||||||
|
|
||||||
- name: Unzip build asset
|
|
||||||
working-directory: apps/web
|
|
||||||
run: unzip ${{ env._WEB_ARTIFACT }}
|
|
||||||
|
|
||||||
- name: Empty container in Storage Account
|
|
||||||
run: |
|
|
||||||
az storage blob delete-batch \
|
|
||||||
--source '$web' \
|
|
||||||
--pattern '*' \
|
|
||||||
--connection-string "${{ steps.retrieve-secrets.outputs.sa-bitwarden-web-vault-dev-key-temp }}"
|
|
||||||
|
|
||||||
- name: Deploy to Azure Storage Account
|
|
||||||
working-directory: apps/web
|
|
||||||
run: |
|
|
||||||
az storage blob upload-batch \
|
|
||||||
--source "./build" \
|
|
||||||
--destination '$web' \
|
|
||||||
--connection-string "${{ steps.retrieve-secrets.outputs.sa-bitwarden-web-vault-dev-key-temp }}" \
|
|
||||||
--overwrite \
|
|
||||||
--no-progress
|
|
||||||
|
|
||||||
notify:
|
|
||||||
name: Notify Slack with result
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
if: always()
|
|
||||||
needs: azure-deploy
|
|
||||||
steps:
|
|
||||||
- uses: bitwarden/gh-actions/report-deployment-status-to-slack@main
|
|
||||||
with:
|
|
||||||
project: Web
|
|
||||||
environment: EU QA Cloud
|
|
||||||
tag: ${{ github.event.inputs.tag }}
|
|
||||||
slack-channel: team-eng-qa-devops
|
|
||||||
event: ${{ needs.azure-deploy.result }}
|
|
||||||
url: https://github.com/bitwarden/devops/actions/runs/${{ github.run_id }}
|
|
||||||
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: Deploy Web - Non-Prod
|
name: Deploy Web Vault
|
||||||
run-name: Deploy Web ${{ inputs.environment }}
|
run-name: Deploy Web Vault to ${{ inputs.environment }}
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@ -10,16 +10,28 @@ on:
|
|||||||
default: 'QA'
|
default: 'QA'
|
||||||
type: choice
|
type: choice
|
||||||
options:
|
options:
|
||||||
- QA
|
- USQA
|
||||||
- EUQA
|
- EUQA
|
||||||
- USPROD
|
- USPROD
|
||||||
|
- EUPROD
|
||||||
|
branch-or-tag:
|
||||||
|
description: "Branch or Tag name to deploy (examples: 'main', 'feature/sm', 'web-v2023.12.0')"
|
||||||
|
type: string
|
||||||
|
default: main
|
||||||
|
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
environment:
|
environment:
|
||||||
description: 'Environment'
|
description: 'Environment'
|
||||||
default: 'QA'
|
default: 'USQA'
|
||||||
type: string
|
type: string
|
||||||
|
branch-or-tag:
|
||||||
|
description: "Branch or Tag name to deploy (examples: 'main', 'feature/sm', 'web-v2023.12.0')"
|
||||||
|
type: string
|
||||||
|
default: main
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
deployments: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
setup:
|
setup:
|
||||||
@ -29,7 +41,6 @@ jobs:
|
|||||||
environment: ${{ steps.config.outputs.environment }}
|
environment: ${{ steps.config.outputs.environment }}
|
||||||
environment-url: ${{ steps.config.outputs.environment-url }}
|
environment-url: ${{ steps.config.outputs.environment-url }}
|
||||||
environment-name: ${{ steps.config.outputs.environment-name }}
|
environment-name: ${{ steps.config.outputs.environment-name }}
|
||||||
environment-branch: ${{ steps.config.outputs.environment-branch }}
|
|
||||||
environment-artifact: ${{ steps.config.outputs.environment-artifact }}
|
environment-artifact: ${{ steps.config.outputs.environment-artifact }}
|
||||||
azure-login-creds: ${{ steps.config.outputs.azure-login-creds }}
|
azure-login-creds: ${{ steps.config.outputs.azure-login-creds }}
|
||||||
retrieve-secrets-keyvault: ${{ steps.config.outputs.retrieve-secrets-keyvault }}
|
retrieve-secrets-keyvault: ${{ steps.config.outputs.retrieve-secrets-keyvault }}
|
||||||
@ -40,33 +51,59 @@ jobs:
|
|||||||
ENV_NAME_LOWER=$(echo "${{ inputs.environment }}" | awk '{print tolower($0)}')
|
ENV_NAME_LOWER=$(echo "${{ inputs.environment }}" | awk '{print tolower($0)}')
|
||||||
echo "configuring the Web deploy for ${{ inputs.environment }}"
|
echo "configuring the Web deploy for ${{ inputs.environment }}"
|
||||||
echo "environment=${{ inputs.environment }}" >> $GITHUB_OUTPUT
|
echo "environment=${{ inputs.environment }}" >> $GITHUB_OUTPUT
|
||||||
echo "environment-url=http://vault.$ENV_NAME_LOWER.bitwarden.pw" >> $GITHUB_OUTPUT
|
case ${{ inputs.environment }} in
|
||||||
echo "environment-name=Web Vault - ${{ inputs.environment }}" >> $GITHUB_OUTPUT
|
"USQA")
|
||||||
echo "environment-branch=cf-pages-$ENV_NAME_LOWER" >> $GITHUB_OUTPUT
|
echo "azure-login-creds=AZURE_KV_US_QA_SERVICE_PRINCIPAL" >> $GITHUB_OUTPUT
|
||||||
if [ ${{ inputs.environment }} == "QA" ]; then
|
echo "retrieve-secrets-keyvault=bw-webvault-rlktusqa-kv" >> $GITHUB_OUTPUT
|
||||||
echo "azure-login-creds=AZURE_KV_US_QA_SERVICE_PRINCIPAL" >> $GITHUB_OUTPUT
|
echo "environment-artifact=web-*-cloud-QA.zip" >> $GITHUB_OUTPUT
|
||||||
echo "retrieve-secrets-keyvault=bw-webvault-rlktusqa-kv" >> $GITHUB_OUTPUT
|
echo "environment-name=Web Vault - US QA Cloud" >> $GITHUB_OUTPUT
|
||||||
echo "environment-artifact=web-*-cloud-QA.zip" >> $GITHUB_OUTPUT
|
echo "environment-url=http://vault.$ENV_NAME_LOWER.bitwarden.pw" >> $GITHUB_OUTPUT
|
||||||
elif [ ${{ inputs.environment }} == "EUQA" ]; then
|
;;
|
||||||
echo "azure-login-creds=AZURE_KV_EU_QA_SERVICE_PRINCIPAL" >> $GITHUB_OUTPUT
|
"EUQA")
|
||||||
echo "retrieve-secrets-keyvault=webvaulteu-westeurope-qa" >> $GITHUB_OUTPUT
|
echo "azure-login-creds=AZURE_KV_EU_QA_SERVICE_PRINCIPAL" >> $GITHUB_OUTPUT
|
||||||
echo "environment-artifact=web-*-cloud-euqa.zip" >> $GITHUB_OUTPUT
|
echo "retrieve-secrets-keyvault=webvaulteu-westeurope-qa" >> $GITHUB_OUTPUT
|
||||||
elif [ ${{ inputs.environment }} == "USPROD" ]; then
|
echo "environment-artifact=web-*-cloud-euqa.zip" >> $GITHUB_OUTPUT
|
||||||
echo "azure-login-creds=AZURE_KV_US_PROD_SERVICE_PRINCIPAL" >> $GITHUB_OUTPUT
|
echo "environment-name=Web Vault - EU QA Cloud" >> $GITHUB_OUTPUT
|
||||||
echo "retrieve-secrets-keyvault=bw-webvault-klrt-kv" >> $GITHUB_OUTPUT
|
echo "environment-url=http://vault.$ENV_NAME_LOWER.bitwarden.pw" >> $GITHUB_OUTPUT
|
||||||
echo "environment-artifact=web-*-cloud-COMMERCIAL.zip" >> $GITHUB_OUTPUT
|
;;
|
||||||
fi
|
"USPROD")
|
||||||
|
echo "azure-login-creds=AZURE_KV_US_PROD_SERVICE_PRINCIPAL" >> $GITHUB_OUTPUT
|
||||||
|
echo "retrieve-secrets-keyvault=bw-webvault-klrt-kv" >> $GITHUB_OUTPUT
|
||||||
|
echo "environment-artifact=web-*-cloud-COMMERCIAL.zip" >> $GITHUB_OUTPUT
|
||||||
|
echo "environment-name=Web Vault - US Production Cloud" >> $GITHUB_OUTPUT
|
||||||
|
echo "environment-url=http://vault.bitwarden.com" >> $GITHUB_OUTPUT
|
||||||
|
;;
|
||||||
|
"EUPROD")
|
||||||
|
echo "azure-login-creds=AZURE_KV_EU_PRD_SERVICE_PRINCIPAL" >> $GITHUB_OUTPUT
|
||||||
|
echo "retrieve-secrets-keyvault=webvault-westeurope-prod" >> $GITHUB_OUTPUT
|
||||||
|
echo "environment-artifact=web-*-cloud-euprd.zip" >> $GITHUB_OUTPUT
|
||||||
|
echo "environment-name=Web Vault - EU Production Cloud" >> $GITHUB_OUTPUT
|
||||||
|
echo "environment-url=http://vault.bitwarden.eu" >> $GITHUB_OUTPUT
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
approval:
|
||||||
|
name: Approval for Deployment to ${{ needs.setup.outputs.environment-name }}
|
||||||
|
needs: setup
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
environment: ${{ needs.setup.outputs.environment-name }}
|
||||||
|
steps:
|
||||||
|
- name: Success Code
|
||||||
|
run: exit 0
|
||||||
|
|
||||||
notify-start:
|
notify-start:
|
||||||
name: Notify Slack with start message
|
name: Notify Slack with start message
|
||||||
|
needs:
|
||||||
|
- approval
|
||||||
|
- setup
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
if: always()
|
if: always()
|
||||||
steps:
|
steps:
|
||||||
- uses: bitwarden/gh-actions/report-deployment-status-to-slack@main
|
- uses: bitwarden/gh-actions/report-deployment-status-to-slack@main
|
||||||
with:
|
with:
|
||||||
project: Web
|
project: Clients
|
||||||
environment: US ${{ inputs.environment }} Cloud
|
environment: ${{ needs.setup.outputs.environment-name }}
|
||||||
tag: ${{ github.ref_name }}
|
tag: ${{ inputs.branch-or-tag }}
|
||||||
slack-channel: team-eng-qa-devops
|
slack-channel: team-eng-qa-devops
|
||||||
event: 'start'
|
event: 'start'
|
||||||
url: https://github.com/bitwarden/clients/actions/runs/${{ github.run_id }}
|
url: https://github.com/bitwarden/clients/actions/runs/${{ github.run_id }}
|
||||||
@ -79,7 +116,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
_ENVIRONMENT_ARTIFACT: ${{ needs.setup.outputs.environment-artifact }}
|
_ENVIRONMENT_ARTIFACT: ${{ needs.setup.outputs.environment-artifact }}
|
||||||
steps:
|
steps:
|
||||||
- name: Download latest cloud asset
|
- name: 'Download latest cloud asset from branch/tag: ${{ inputs.branch-or-tag }}'
|
||||||
uses: bitwarden/gh-actions/download-artifacts@main
|
uses: bitwarden/gh-actions/download-artifacts@main
|
||||||
id: download-artifacts
|
id: download-artifacts
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
@ -87,7 +124,7 @@ jobs:
|
|||||||
workflow: build-web.yml
|
workflow: build-web.yml
|
||||||
path: apps/web
|
path: apps/web
|
||||||
workflow_conclusion: success
|
workflow_conclusion: success
|
||||||
branch: ${{ github.ref_name }}
|
branch: ${{ inputs.branch-or-tag }}
|
||||||
artifacts: ${{ env._ENVIRONMENT_ARTIFACT }}
|
artifacts: ${{ env._ENVIRONMENT_ARTIFACT }}
|
||||||
|
|
||||||
- name: Login to Azure
|
- name: Login to Azure
|
||||||
@ -104,7 +141,7 @@ jobs:
|
|||||||
keyvault: "bitwarden-ci"
|
keyvault: "bitwarden-ci"
|
||||||
secrets: "github-pat-bitwarden-devops-bot-repo-scope"
|
secrets: "github-pat-bitwarden-devops-bot-repo-scope"
|
||||||
|
|
||||||
- name: Build server missing branch
|
- name: 'Trigger build web for missing branch/tag ${{ inputs.branch-or-tag }}'
|
||||||
if: ${{ steps.download-artifacts.outcome == 'failure' }}
|
if: ${{ steps.download-artifacts.outcome == 'failure' }}
|
||||||
uses: convictional/trigger-workflow-and-wait@f69fa9eedd3c62a599220f4d5745230e237904be # v1.6.5
|
uses: convictional/trigger-workflow-and-wait@f69fa9eedd3c62a599220f4d5745230e237904be # v1.6.5
|
||||||
with:
|
with:
|
||||||
@ -112,21 +149,21 @@ jobs:
|
|||||||
repo: clients
|
repo: clients
|
||||||
github_token: ${{ steps.retrieve-secret.outputs.github-pat-bitwarden-devops-bot-repo-scope }}
|
github_token: ${{ steps.retrieve-secret.outputs.github-pat-bitwarden-devops-bot-repo-scope }}
|
||||||
workflow_file_name: build-web.yml
|
workflow_file_name: build-web.yml
|
||||||
ref: ${{ github.ref_name }}
|
ref: ${{ inputs.branch-or-tag }}
|
||||||
wait_interval: 100
|
wait_interval: 100
|
||||||
|
|
||||||
cfpages-deploy:
|
azure-deploy:
|
||||||
name: Deploy Web Vault to ${{ inputs.environment }} CloudFlare Pages branch
|
name: Deploy Web Vault to ${{ inputs.environment }} Storage Account
|
||||||
if : ${{ inputs.environment == 'QA' }}
|
|
||||||
needs:
|
needs:
|
||||||
- setup
|
- setup
|
||||||
- artifact-check
|
- artifact-check
|
||||||
|
- approval
|
||||||
|
- notify-start
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
env:
|
env:
|
||||||
_ENVIRONMENT: ${{ needs.setup.outputs.environment }}
|
_ENVIRONMENT: ${{ needs.setup.outputs.environment }}
|
||||||
_ENVIRONMENT_URL: ${{ needs.setup.outputs.environment-url }}
|
_ENVIRONMENT_URL: ${{ needs.setup.outputs.environment-url }}
|
||||||
_ENVIRONMENT_NAME: ${{ needs.setup.outputs.environment-name }}
|
_ENVIRONMENT_NAME: ${{ needs.setup.outputs.environment-name }}
|
||||||
_ENVIRONMENT_BRANCH: ${{ needs.setup.outputs.environment-branch }}
|
|
||||||
_ENVIRONMENT_ARTIFACT: ${{ needs.setup.outputs.environment-artifact }}
|
_ENVIRONMENT_ARTIFACT: ${{ needs.setup.outputs.environment-artifact }}
|
||||||
steps:
|
steps:
|
||||||
- name: Create GitHub deployment
|
- name: Create GitHub deployment
|
||||||
@ -137,81 +174,9 @@ jobs:
|
|||||||
initial-status: 'in_progress'
|
initial-status: 'in_progress'
|
||||||
environment-url: ${{ env._ENVIRONMENT_URL }}
|
environment-url: ${{ env._ENVIRONMENT_URL }}
|
||||||
environment: ${{ env._ENVIRONMENT_NAME }}
|
environment: ${{ env._ENVIRONMENT_NAME }}
|
||||||
description: 'Deployment from branch ${{ github.ref_name }}'
|
task: 'deploy'
|
||||||
|
description: 'Deployment from branch/tag: ${{ inputs.branch-or-tag }}'
|
||||||
|
|
||||||
- name: Checkout Repo
|
|
||||||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
|
||||||
|
|
||||||
- name: Download latest cloud asset
|
|
||||||
uses: bitwarden/gh-actions/download-artifacts@main
|
|
||||||
with:
|
|
||||||
workflow: build-web.yml
|
|
||||||
path: apps/web
|
|
||||||
workflow_conclusion: success
|
|
||||||
branch: ${{ github.ref_name }}
|
|
||||||
artifacts: ${{ env._ENVIRONMENT_ARTIFACT }}
|
|
||||||
|
|
||||||
- name: Unzip cloud asset
|
|
||||||
working-directory: apps/web
|
|
||||||
run: unzip ${{ env._ENVIRONMENT_ARTIFACT }}
|
|
||||||
|
|
||||||
- name: Checkout Repo
|
|
||||||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
|
||||||
with:
|
|
||||||
ref: ${{ env._ENVIRONMENT_BRANCH }}
|
|
||||||
path: deployment
|
|
||||||
|
|
||||||
- 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: Deploy CloudFlare Pages
|
|
||||||
run: |
|
|
||||||
rm -rf ./*
|
|
||||||
cp -R ../apps/web/build/* .
|
|
||||||
working-directory: deployment
|
|
||||||
|
|
||||||
- name: Push new ver to ${{ env._ENVIRONMENT_BRANCH }}
|
|
||||||
run: |
|
|
||||||
if [ -n "$(git status --porcelain)" ]; then
|
|
||||||
git add .
|
|
||||||
git commit -m "Deploy ${{ github.ref_name }} to ${{ env._ENVIRONMENT }} Cloudflare pages"
|
|
||||||
git push -u origin ${{ env._ENVIRONMENT_BRANCH }}
|
|
||||||
else
|
|
||||||
echo "No changes to commit!";
|
|
||||||
fi
|
|
||||||
working-directory: deployment
|
|
||||||
|
|
||||||
- name: Update deployment status to Success
|
|
||||||
if: ${{ success() }}
|
|
||||||
uses: chrnorm/deployment-status@2afb7d27101260f4a764219439564d954d10b5b0 # v2.0.1
|
|
||||||
with:
|
|
||||||
token: '${{ secrets.GITHUB_TOKEN }}'
|
|
||||||
environment-url: ${{ env._ENVIRONMENT_URL }}
|
|
||||||
state: 'success'
|
|
||||||
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
|
|
||||||
|
|
||||||
- name: Update deployment status to Failure
|
|
||||||
if: ${{ failure() }}
|
|
||||||
uses: chrnorm/deployment-status@2afb7d27101260f4a764219439564d954d10b5b0 # v2.0.1
|
|
||||||
with:
|
|
||||||
token: '${{ secrets.GITHUB_TOKEN }}'
|
|
||||||
environment-url: ${{ env._ENVIRONMENT_URL }}
|
|
||||||
state: 'failure'
|
|
||||||
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
|
|
||||||
|
|
||||||
azure-deploy:
|
|
||||||
name: Deploy Web Vault to ${{ inputs.environment }} Storage Account
|
|
||||||
needs:
|
|
||||||
- setup
|
|
||||||
- artifact-check
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
env:
|
|
||||||
_ENVIRONMENT_ARTIFACT: ${{ needs.setup.outputs.environment-artifact }}
|
|
||||||
steps:
|
|
||||||
- name: Login to Azure
|
- name: Login to Azure
|
||||||
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7
|
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7
|
||||||
with:
|
with:
|
||||||
@ -224,13 +189,13 @@ jobs:
|
|||||||
keyvault: ${{ needs.setup.outputs.retrieve-secrets-keyvault }}
|
keyvault: ${{ needs.setup.outputs.retrieve-secrets-keyvault }}
|
||||||
secrets: "sa-bitwarden-web-vault-dev-key-temp"
|
secrets: "sa-bitwarden-web-vault-dev-key-temp"
|
||||||
|
|
||||||
- name: Download latest cloud asset
|
- name: 'Download cloud asset from branch/tag: ${{ inputs.branch-or-tag }}'
|
||||||
uses: bitwarden/gh-actions/download-artifacts@main
|
uses: bitwarden/gh-actions/download-artifacts@main
|
||||||
with:
|
with:
|
||||||
workflow: build-web.yml
|
workflow: build-web.yml
|
||||||
path: apps/web
|
path: apps/web
|
||||||
workflow_conclusion: success
|
workflow_conclusion: success
|
||||||
branch: ${{ github.event.inputs.tag }}
|
branch: ${{ inputs.branch-or-tag }}
|
||||||
artifacts: ${{ env._ENVIRONMENT_ARTIFACT }}
|
artifacts: ${{ env._ENVIRONMENT_ARTIFACT }}
|
||||||
|
|
||||||
- name: Unzip build asset
|
- name: Unzip build asset
|
||||||
@ -254,20 +219,38 @@ jobs:
|
|||||||
--overwrite \
|
--overwrite \
|
||||||
--no-progress
|
--no-progress
|
||||||
|
|
||||||
|
- name: Update deployment status to Success
|
||||||
|
if: success()
|
||||||
|
uses: chrnorm/deployment-status@2afb7d27101260f4a764219439564d954d10b5b0 # v2.0.1
|
||||||
|
with:
|
||||||
|
token: '${{ secrets.GITHUB_TOKEN }}'
|
||||||
|
environment-url: ${{ env._ENVIRONMENT_URL }}
|
||||||
|
state: 'success'
|
||||||
|
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
|
||||||
|
|
||||||
|
- name: Update deployment status to Failure
|
||||||
|
if: failure()
|
||||||
|
uses: chrnorm/deployment-status@2afb7d27101260f4a764219439564d954d10b5b0 # v2.0.1
|
||||||
|
with:
|
||||||
|
token: '${{ secrets.GITHUB_TOKEN }}'
|
||||||
|
environment-url: ${{ env._ENVIRONMENT_URL }}
|
||||||
|
state: 'failure'
|
||||||
|
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
|
||||||
|
|
||||||
notify:
|
notify:
|
||||||
name: Notify Slack with result
|
name: Notify Slack with result
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
if: always()
|
if: always()
|
||||||
needs:
|
needs:
|
||||||
- cfpages-deploy
|
- azure-deploy
|
||||||
- setup
|
- setup
|
||||||
steps:
|
steps:
|
||||||
- uses: bitwarden/gh-actions/report-deployment-status-to-slack@main
|
- uses: bitwarden/gh-actions/report-deployment-status-to-slack@main
|
||||||
with:
|
with:
|
||||||
project: Web
|
project: Clients
|
||||||
environment: US ${{ inputs.environment }} Cloud
|
environment: ${{ needs.setup.outputs.environment-name }}
|
||||||
tag: ${{ github.ref_name }}
|
tag: ${{ inputs.branch-or-tag }}
|
||||||
slack-channel: team-eng-qa-devops
|
slack-channel: team-eng-qa-devops
|
||||||
event: ${{ needs.cfpages-deploy.result }}
|
event: ${{ needs.azure-deploy.result }}
|
||||||
url: https://github.com/bitwarden/clients/actions/runs/${{ github.run_id }}
|
url: https://github.com/bitwarden/clients/actions/runs/${{ github.run_id }}
|
||||||
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
Loading…
Reference in New Issue
Block a user