2023-06-20 20:42:29 +02:00
|
|
|
---
|
2023-06-22 22:36:21 +02:00
|
|
|
name: Deploy Web to EU-PRD Cloud
|
2023-06-20 20:42:29 +02:00
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2023-06-22 22:36:21 +02:00
|
|
|
inputs:
|
|
|
|
tag:
|
|
|
|
description: "Branch name to deploy (examples: 'master', 'feature/sm')"
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
default: master
|
2023-06-20 20:42:29 +02:00
|
|
|
|
|
|
|
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
|
2023-06-29 16:46:56 +02:00
|
|
|
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7
|
2023-06-20 20:42:29 +02:00
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_KV_EU_PRD_SERVICE_PRINCIPAL }}
|
|
|
|
|
|
|
|
- name: Retrieve Storage Account connection string
|
|
|
|
id: retrieve-secrets
|
2023-09-25 14:33:02 +02:00
|
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@62d1bf7c3e31c458cc7236b1e69a475d235cd78f
|
2023-06-20 20:42:29 +02:00
|
|
|
with:
|
|
|
|
keyvault: webvault-westeurope-prod
|
|
|
|
secrets: "sa-bitwarden-web-vault-dev-key-temp"
|
|
|
|
|
|
|
|
- name: Download latest cloud asset
|
2023-09-25 14:33:02 +02:00
|
|
|
uses: bitwarden/gh-actions/download-artifacts@62d1bf7c3e31c458cc7236b1e69a475d235cd78f
|
2023-06-20 20:42:29 +02:00
|
|
|
with:
|
|
|
|
workflow: build-web.yml
|
|
|
|
path: apps/web
|
|
|
|
workflow_conclusion: success
|
2023-06-22 22:36:21 +02:00
|
|
|
branch: ${{ github.event.inputs.tag }}
|
2023-06-20 20:42:29 +02:00
|
|
|
artifacts: ${{ env._WEB_ARTIFACT }}
|
|
|
|
|
|
|
|
- name: Unzip build asset
|
|
|
|
working-directory: apps/web
|
|
|
|
run: unzip ${{ env._WEB_ARTIFACT }}
|
|
|
|
|
2023-06-26 19:38:32 +02:00
|
|
|
- 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 }}"
|
|
|
|
|
2023-06-20 20:42:29 +02:00
|
|
|
- name: Deploy to Azure Storage Account
|
|
|
|
working-directory: apps/web
|
|
|
|
run: |
|
2023-06-26 19:38:32 +02:00
|
|
|
az storage blob upload-batch \
|
|
|
|
--source "./build" \
|
2023-06-20 20:42:29 +02:00
|
|
|
--destination '$web' \
|
|
|
|
--connection-string "${{ steps.retrieve-secrets.outputs.sa-bitwarden-web-vault-dev-key-temp }}" \
|
|
|
|
--overwrite \
|
|
|
|
--no-progress
|