2022-06-03 16:35:46 +02:00
|
|
|
name: Build Web
|
2020-12-21 18:46:36 +01:00
|
|
|
|
|
|
|
on:
|
2024-12-12 18:22:55 +01:00
|
|
|
pull_request_target:
|
2024-11-07 19:01:54 +01:00
|
|
|
types: [opened, synchronize]
|
2020-12-21 18:46:36 +01:00
|
|
|
branches-ignore:
|
2022-06-03 16:35:46 +02:00
|
|
|
- 'l10n_master'
|
2022-06-20 21:16:51 +02:00
|
|
|
- 'cf-pages'
|
2022-06-03 16:35:46 +02:00
|
|
|
paths:
|
|
|
|
- 'apps/web/**'
|
2022-06-08 19:53:35 +02:00
|
|
|
- 'libs/**'
|
2022-06-13 09:59:15 +02:00
|
|
|
- '*'
|
|
|
|
- '!*.md'
|
|
|
|
- '!*.txt'
|
2022-06-03 16:35:46 +02:00
|
|
|
- '.github/workflows/build-web.yml'
|
|
|
|
push:
|
|
|
|
branches:
|
2023-12-12 20:57:50 +01:00
|
|
|
- 'main'
|
2022-06-03 16:35:46 +02:00
|
|
|
- 'rc'
|
2022-08-16 17:55:57 +02:00
|
|
|
- 'hotfix-rc-web'
|
2022-06-03 16:35:46 +02:00
|
|
|
paths:
|
|
|
|
- 'apps/web/**'
|
2022-06-08 19:53:35 +02:00
|
|
|
- 'libs/**'
|
2022-06-13 09:59:15 +02:00
|
|
|
- '*'
|
|
|
|
- '!*.md'
|
|
|
|
- '!*.txt'
|
2022-06-03 16:35:46 +02:00
|
|
|
- '.github/workflows/build-web.yml'
|
2024-02-08 18:13:32 +01:00
|
|
|
release:
|
|
|
|
types: [published]
|
2022-06-03 16:35:46 +02:00
|
|
|
workflow_dispatch:
|
2022-06-20 18:23:11 +02:00
|
|
|
inputs:
|
|
|
|
custom_tag_extension:
|
|
|
|
description: "Custom image tag extension"
|
|
|
|
required: false
|
2024-11-19 13:59:59 +01:00
|
|
|
sdk_branch:
|
|
|
|
description: "Custom SDK branch"
|
|
|
|
required: false
|
|
|
|
type: string
|
2022-03-08 22:39:54 +01:00
|
|
|
|
2023-08-16 17:41:02 +02:00
|
|
|
env:
|
|
|
|
_AZ_REGISTRY: bitwardenprod.azurecr.io
|
|
|
|
|
2020-12-21 18:46:36 +01:00
|
|
|
jobs:
|
2024-12-12 18:22:55 +01:00
|
|
|
check-run:
|
|
|
|
name: Check PR run
|
|
|
|
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main
|
|
|
|
|
2021-10-08 18:54:42 +02:00
|
|
|
setup:
|
|
|
|
name: Setup
|
2022-09-19 22:38:19 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2024-12-12 18:22:55 +01:00
|
|
|
needs:
|
|
|
|
- check-run
|
2021-10-08 18:54:42 +02:00
|
|
|
outputs:
|
|
|
|
version: ${{ steps.version.outputs.value }}
|
2023-10-04 18:23:40 +02:00
|
|
|
node_version: ${{ steps.retrieve-node-version.outputs.node_version }}
|
2021-10-08 18:54:42 +02:00
|
|
|
steps:
|
2024-11-07 19:01:54 +01:00
|
|
|
- name: Check out repo
|
2024-10-30 16:29:15 +01:00
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2024-11-07 19:01:54 +01:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
2021-10-08 18:54:42 +02:00
|
|
|
|
|
|
|
- name: Get GitHub sha as version
|
|
|
|
id: version
|
2022-12-05 16:04:04 +01:00
|
|
|
run: echo "value=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT
|
2021-10-08 18:54:42 +02:00
|
|
|
|
2023-10-04 18:23:40 +02:00
|
|
|
- name: Get Node Version
|
|
|
|
id: retrieve-node-version
|
|
|
|
run: |
|
|
|
|
NODE_NVMRC=$(cat .nvmrc)
|
|
|
|
NODE_VERSION=${NODE_NVMRC/v/''}
|
|
|
|
echo "node_version=$NODE_VERSION" >> $GITHUB_OUTPUT
|
|
|
|
|
2022-09-19 22:38:19 +02:00
|
|
|
build-artifacts:
|
|
|
|
name: Build artifacts
|
|
|
|
runs-on: ubuntu-22.04
|
2024-11-11 19:19:33 +01:00
|
|
|
needs:
|
|
|
|
- setup
|
2021-10-08 18:54:42 +02:00
|
|
|
env:
|
|
|
|
_VERSION: ${{ needs.setup.outputs.version }}
|
2023-10-04 18:23:40 +02:00
|
|
|
_NODE_VERSION: ${{ needs.setup.outputs.node_version }}
|
2022-09-19 22:38:19 +02:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- name: "selfhosted-open-source"
|
|
|
|
npm_command: "dist:oss:selfhost"
|
|
|
|
- name: "cloud-COMMERCIAL"
|
|
|
|
npm_command: "dist:bit:cloud"
|
|
|
|
- name: "selfhosted-COMMERCIAL"
|
|
|
|
npm_command: "dist:bit:selfhost"
|
|
|
|
- name: "cloud-QA"
|
|
|
|
npm_command: "build:bit:qa"
|
2024-02-28 20:01:15 +01:00
|
|
|
git_metadata: true
|
2022-09-29 12:21:47 +02:00
|
|
|
- name: "ee"
|
|
|
|
npm_command: "build:bit:ee"
|
2024-02-28 20:01:15 +01:00
|
|
|
git_metadata: true
|
2023-06-15 18:54:39 +02:00
|
|
|
- name: "cloud-euprd"
|
|
|
|
npm_command: "build:bit:euprd"
|
2023-06-28 22:03:30 +02:00
|
|
|
- name: "cloud-euqa"
|
|
|
|
npm_command: "build:bit:euqa"
|
2024-02-28 20:01:15 +01:00
|
|
|
git_metadata: true
|
2023-12-21 17:10:31 +01:00
|
|
|
- name: "cloud-usdev"
|
|
|
|
npm_command: "build:bit:usdev"
|
2024-02-28 20:01:15 +01:00
|
|
|
git_metadata: true
|
2022-09-19 22:38:19 +02:00
|
|
|
|
2020-12-21 18:46:36 +01:00
|
|
|
steps:
|
2024-11-07 19:01:54 +01:00
|
|
|
- name: Check out repo
|
2024-10-30 16:29:15 +01:00
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2024-11-07 19:01:54 +01:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
2022-03-17 14:02:50 +01:00
|
|
|
|
2020-12-21 18:46:36 +01:00
|
|
|
- name: Set up Node
|
2024-10-30 16:29:15 +01:00
|
|
|
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
2020-12-21 18:46:36 +01:00
|
|
|
with:
|
2022-03-16 16:18:47 +01:00
|
|
|
cache: 'npm'
|
|
|
|
cache-dependency-path: '**/package-lock.json'
|
2023-10-04 18:23:40 +02:00
|
|
|
node-version: ${{ env._NODE_VERSION }}
|
2021-05-26 22:17:37 +02:00
|
|
|
|
2020-12-21 18:46:36 +01:00
|
|
|
- name: Print environment
|
|
|
|
run: |
|
|
|
|
whoami
|
|
|
|
node --version
|
|
|
|
npm --version
|
|
|
|
docker --version
|
|
|
|
echo "GitHub ref: $GITHUB_REF"
|
|
|
|
echo "GitHub event: $GITHUB_EVENT"
|
|
|
|
|
2021-06-14 21:20:49 +02:00
|
|
|
- name: Install dependencies
|
2021-09-21 18:37:17 +02:00
|
|
|
run: npm ci
|
2021-06-14 21:20:49 +02:00
|
|
|
|
2024-11-19 13:59:59 +01:00
|
|
|
- name: Download SDK Artifacts
|
2024-12-12 18:22:55 +01:00
|
|
|
if: ${{ inputs.sdk_branch != '' }}
|
2024-11-19 13:59:59 +01:00
|
|
|
uses: bitwarden/gh-actions/download-artifacts@main
|
|
|
|
with:
|
|
|
|
github_token: ${{secrets.GITHUB_TOKEN}}
|
|
|
|
workflow: build-wasm-internal.yml
|
|
|
|
workflow_conclusion: success
|
|
|
|
branch: ${{ inputs.sdk_branch }}
|
|
|
|
artifacts: sdk-internal
|
|
|
|
repo: bitwarden/sdk-internal
|
|
|
|
path: ../sdk-internal
|
|
|
|
if_no_artifact_found: fail
|
|
|
|
|
|
|
|
- name: Override SDK
|
2024-12-12 18:22:55 +01:00
|
|
|
if: ${{ inputs.sdk_branch != '' }}
|
2024-11-19 13:59:59 +01:00
|
|
|
working-directory: ./
|
|
|
|
run: |
|
|
|
|
ls -l ../
|
|
|
|
npm link ../sdk-internal
|
|
|
|
|
2024-02-28 20:01:15 +01:00
|
|
|
- name: Add Git metadata to build version
|
2022-06-03 16:35:46 +02:00
|
|
|
working-directory: apps/web
|
2024-02-28 20:01:15 +01:00
|
|
|
if: matrix.git_metadata
|
2021-09-21 18:37:17 +02:00
|
|
|
run: |
|
2022-09-19 22:38:19 +02:00
|
|
|
VERSION=$( jq -r ".version" package.json)
|
2022-11-22 15:29:59 +01:00
|
|
|
jq --arg version "$VERSION+${GITHUB_SHA:0:7}" '.version = $version' package.json > package.json.tmp
|
2022-09-19 22:38:19 +02:00
|
|
|
mv package.json.tmp package.json
|
2021-10-08 18:54:42 +02:00
|
|
|
|
2022-09-19 22:38:19 +02:00
|
|
|
- name: Build ${{ matrix.name }}
|
|
|
|
working-directory: apps/web
|
|
|
|
run: npm run ${{ matrix.npm_command }}
|
2021-09-21 18:37:17 +02:00
|
|
|
|
2022-10-12 01:57:19 +02:00
|
|
|
- name: Package artifact
|
|
|
|
working-directory: apps/web
|
|
|
|
run: zip -r web-${{ env._VERSION }}-${{ matrix.name }}.zip build
|
|
|
|
|
2022-09-19 22:38:19 +02:00
|
|
|
- name: Upload ${{ matrix.name }} artifact
|
2024-10-17 16:45:49 +02:00
|
|
|
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
|
2021-06-14 21:20:49 +02:00
|
|
|
with:
|
2022-09-19 22:38:19 +02:00
|
|
|
name: web-${{ env._VERSION }}-${{ matrix.name }}.zip
|
2022-10-12 01:57:19 +02:00
|
|
|
path: apps/web/web-${{ env._VERSION }}-${{ matrix.name }}.zip
|
2021-09-21 18:37:17 +02:00
|
|
|
if-no-files-found: error
|
2021-06-14 21:20:49 +02:00
|
|
|
|
|
|
|
|
2022-09-29 12:21:47 +02:00
|
|
|
build-containers:
|
2023-02-17 16:36:53 +01:00
|
|
|
name: Build Docker images
|
2022-09-19 22:38:19 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2022-03-07 17:02:23 +01:00
|
|
|
needs:
|
|
|
|
- setup
|
2022-09-19 22:38:19 +02:00
|
|
|
- build-artifacts
|
2022-09-29 12:21:47 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- artifact_name: cloud-QA
|
2023-02-17 16:36:53 +01:00
|
|
|
image_name: web-qa-cloud
|
2022-09-29 12:21:47 +02:00
|
|
|
- artifact_name: ee
|
|
|
|
image_name: web-ee
|
2023-02-17 16:36:53 +01:00
|
|
|
- artifact_name: selfhosted-COMMERCIAL
|
|
|
|
image_name: web
|
2022-09-19 22:38:19 +02:00
|
|
|
env:
|
|
|
|
_VERSION: ${{ needs.setup.outputs.version }}
|
2021-10-08 18:54:42 +02:00
|
|
|
steps:
|
2024-11-07 19:01:54 +01:00
|
|
|
- name: Check out repo
|
2024-10-30 16:29:15 +01:00
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2024-11-07 19:01:54 +01:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
2022-03-17 14:02:50 +01:00
|
|
|
|
2023-02-17 16:36:53 +01:00
|
|
|
- name: Check Branch to Publish
|
|
|
|
env:
|
2023-12-12 20:57:50 +01:00
|
|
|
PUBLISH_BRANCHES: "main,rc,hotfix-rc-web"
|
2023-02-17 16:36:53 +01:00
|
|
|
id: publish-branch-check
|
|
|
|
run: |
|
|
|
|
IFS="," read -a publish_branches <<< $PUBLISH_BRANCHES
|
|
|
|
|
|
|
|
if [[ " ${publish_branches[*]} " =~ " ${GITHUB_REF:11} " ]]; then
|
|
|
|
echo "is_publish_branch=true" >> $GITHUB_ENV
|
|
|
|
else
|
|
|
|
echo "is_publish_branch=false" >> $GITHUB_ENV
|
|
|
|
fi
|
|
|
|
|
|
|
|
########## ACRs ##########
|
2023-08-16 17:41:02 +02:00
|
|
|
- name: Login to Prod Azure
|
2024-02-08 20:38:19 +01:00
|
|
|
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
|
2023-02-17 16:36:53 +01:00
|
|
|
with:
|
2023-08-16 17:41:02 +02:00
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
2023-02-17 16:36:53 +01:00
|
|
|
|
2023-08-16 17:41:02 +02:00
|
|
|
- name: Log into Prod container registry
|
|
|
|
run: az acr login -n bitwardenprod
|
2023-02-17 16:36:53 +01:00
|
|
|
|
2023-08-16 17:41:02 +02:00
|
|
|
- name: Login to Azure - CI Subscription
|
2024-02-08 20:38:19 +01:00
|
|
|
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
|
2021-10-08 18:54:42 +02:00
|
|
|
with:
|
2023-08-16 17:41:02 +02:00
|
|
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
2021-10-08 18:54:42 +02:00
|
|
|
|
2023-08-16 17:41:02 +02:00
|
|
|
- name: Retrieve github PAT secrets
|
|
|
|
id: retrieve-secret-pat
|
2023-11-08 19:08:34 +01:00
|
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
2023-08-16 17:41:02 +02:00
|
|
|
with:
|
|
|
|
keyvault: "bitwarden-ci"
|
|
|
|
secrets: "github-pat-bitwarden-devops-bot-repo-scope"
|
2021-10-08 18:54:42 +02:00
|
|
|
|
2022-09-29 12:21:47 +02:00
|
|
|
- name: Download ${{ matrix.artifact_name }} artifact
|
2024-08-26 22:45:28 +02:00
|
|
|
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
|
2022-09-19 22:38:19 +02:00
|
|
|
with:
|
2022-09-29 12:21:47 +02:00
|
|
|
name: web-${{ env._VERSION }}-${{ matrix.artifact_name }}.zip
|
2022-10-12 01:57:19 +02:00
|
|
|
path: apps/web
|
|
|
|
|
2023-02-17 16:36:53 +01:00
|
|
|
########## Generate image tag and build Docker image ##########
|
|
|
|
- name: Generate Docker image tag
|
|
|
|
id: tag
|
2021-12-23 15:14:10 +01:00
|
|
|
run: |
|
2024-11-13 16:19:38 +01:00
|
|
|
if [[ "${GITHUB_EVENT_NAME}" == "pull_request_target" ]]; then
|
2022-08-08 19:10:18 +02:00
|
|
|
IMAGE_TAG=$(echo "${GITHUB_HEAD_REF}" | sed "s#/#-#g")
|
2022-08-05 21:33:08 +02:00
|
|
|
else
|
2024-02-08 18:13:32 +01:00
|
|
|
IMAGE_TAG=$(echo "${GITHUB_REF_NAME}" | sed "s#/#-#g")
|
2022-08-05 21:33:08 +02:00
|
|
|
fi
|
|
|
|
|
2023-12-12 20:57:50 +01:00
|
|
|
if [[ "$IMAGE_TAG" == "main" ]]; then
|
2023-03-22 20:52:15 +01:00
|
|
|
IMAGE_TAG=dev
|
|
|
|
fi
|
|
|
|
|
2021-12-23 15:14:10 +01:00
|
|
|
TAG_EXTENSION=${{ github.event.inputs.custom_tag_extension }}
|
2021-10-08 18:54:42 +02:00
|
|
|
|
2021-12-23 15:14:10 +01:00
|
|
|
if [[ $TAG_EXTENSION ]]; then
|
|
|
|
IMAGE_TAG=$IMAGE_TAG-$TAG_EXTENSION
|
|
|
|
fi
|
2022-08-05 21:33:08 +02:00
|
|
|
|
2023-02-17 16:36:53 +01:00
|
|
|
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
|
2021-10-08 18:54:42 +02:00
|
|
|
|
2023-02-17 16:36:53 +01:00
|
|
|
########## Build Image ##########
|
|
|
|
- name: Extract artifact
|
|
|
|
working-directory: apps/web
|
|
|
|
run: unzip web-${{ env._VERSION }}-${{ matrix.artifact_name }}.zip
|
2021-10-08 18:54:42 +02:00
|
|
|
|
2023-08-16 17:41:02 +02:00
|
|
|
- name: Generate image full name
|
|
|
|
id: image-name
|
|
|
|
env:
|
|
|
|
IMAGE_TAG: ${{ steps.tag.outputs.image_tag }}
|
|
|
|
PROJECT_NAME: ${{ matrix.image_name }}
|
|
|
|
run: echo "name=$_AZ_REGISTRY/${PROJECT_NAME}:${IMAGE_TAG}" >> $GITHUB_OUTPUT
|
2023-02-17 16:36:53 +01:00
|
|
|
|
|
|
|
- name: Build Docker image
|
2024-10-17 16:45:49 +02:00
|
|
|
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
|
2023-02-17 16:36:53 +01:00
|
|
|
with:
|
|
|
|
context: apps/web
|
|
|
|
file: apps/web/Dockerfile
|
|
|
|
platforms: linux/amd64
|
|
|
|
push: true
|
2023-08-16 17:41:02 +02:00
|
|
|
tags: ${{ steps.image-name.outputs.name }}
|
2023-02-17 16:36:53 +01:00
|
|
|
secrets: |
|
|
|
|
"GH_PAT=${{ steps.retrieve-secret-pat.outputs.github-pat-bitwarden-devops-bot-repo-scope }}"
|
|
|
|
|
2021-10-08 18:54:42 +02:00
|
|
|
- name: Log out of Docker
|
|
|
|
run: docker logout
|
|
|
|
|
2023-02-17 16:36:53 +01:00
|
|
|
|
2021-11-04 19:15:29 +01:00
|
|
|
crowdin-push:
|
|
|
|
name: Crowdin Push
|
2024-11-11 22:38:03 +01:00
|
|
|
if: github.event_name != 'pull_request_target' && github.ref == 'refs/heads/main'
|
2024-11-07 19:01:54 +01:00
|
|
|
needs:
|
|
|
|
- build-artifacts
|
2022-09-19 22:38:19 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2021-11-04 19:15:29 +01:00
|
|
|
steps:
|
2024-11-07 19:01:54 +01:00
|
|
|
- name: Check out repo
|
2024-10-30 16:29:15 +01:00
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2024-11-07 19:01:54 +01:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
2021-11-04 19:15:29 +01:00
|
|
|
|
|
|
|
- name: Login to Azure
|
2024-02-08 20:38:19 +01:00
|
|
|
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
|
2021-11-04 19:15:29 +01:00
|
|
|
with:
|
2023-04-11 18:37:58 +02:00
|
|
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
2021-11-04 19:15:29 +01:00
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2023-11-08 19:08:34 +01:00
|
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
2022-10-13 21:38:47 +02:00
|
|
|
with:
|
2023-04-11 18:37:58 +02:00
|
|
|
keyvault: "bitwarden-ci"
|
2022-10-13 21:38:47 +02:00
|
|
|
secrets: "crowdin-api-token"
|
2021-11-04 19:15:29 +01:00
|
|
|
|
|
|
|
- name: Upload Sources
|
2024-09-04 15:44:00 +02:00
|
|
|
uses: crowdin/github-action@30849777a3cba6ee9a09e24e195272b8287a0a5b # v1.20.4
|
2021-11-04 19:15:29 +01:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }}
|
2022-06-13 09:59:15 +02:00
|
|
|
CROWDIN_PROJECT_ID: "308189"
|
2021-11-04 19:15:29 +01:00
|
|
|
with:
|
2022-06-03 16:35:46 +02:00
|
|
|
config: apps/web/crowdin.yml
|
2023-12-12 20:57:50 +01:00
|
|
|
crowdin_branch_name: main
|
2021-11-04 19:15:29 +01:00
|
|
|
upload_sources: true
|
|
|
|
upload_translations: false
|
|
|
|
|
2024-01-03 16:48:51 +01:00
|
|
|
trigger-web-vault-deploy:
|
|
|
|
name: Trigger web vault deploy
|
2024-11-07 20:42:10 +01:00
|
|
|
if: github.event_name != 'pull_request_target' && github.ref == 'refs/heads/main'
|
2024-01-03 16:48:51 +01:00
|
|
|
runs-on: ubuntu-22.04
|
2024-11-07 19:01:54 +01:00
|
|
|
needs:
|
|
|
|
- build-artifacts
|
2024-01-03 16:48:51 +01:00
|
|
|
steps:
|
|
|
|
- name: Login to Azure - CI Subscription
|
2024-02-08 20:38:19 +01:00
|
|
|
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
|
2024-01-03 16:48:51 +01:00
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
|
|
|
|
|
|
|
- name: Retrieve github PAT secrets
|
|
|
|
id: retrieve-secret-pat
|
|
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
|
|
|
with:
|
|
|
|
keyvault: "bitwarden-ci"
|
|
|
|
secrets: "github-pat-bitwarden-devops-bot-repo-scope"
|
|
|
|
|
2024-03-25 18:05:25 +01:00
|
|
|
- name: Trigger web vault deploy using GitHub Run ID
|
2024-02-08 20:44:13 +01:00
|
|
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
2024-01-03 16:48:51 +01:00
|
|
|
with:
|
|
|
|
github-token: ${{ steps.retrieve-secret-pat.outputs.github-pat-bitwarden-devops-bot-repo-scope }}
|
|
|
|
script: |
|
|
|
|
await github.rest.actions.createWorkflowDispatch({
|
|
|
|
owner: 'bitwarden',
|
|
|
|
repo: 'clients',
|
|
|
|
workflow_id: 'deploy-web.yml',
|
|
|
|
ref: 'main',
|
|
|
|
inputs: {
|
2024-01-05 18:05:11 +01:00
|
|
|
'environment': 'USDEV',
|
2024-03-25 18:05:25 +01:00
|
|
|
'build-web-run-id': '${{ github.run_id }}'
|
2024-01-03 16:48:51 +01:00
|
|
|
}
|
|
|
|
})
|
2022-03-08 22:39:54 +01:00
|
|
|
|
2021-10-14 20:34:31 +02:00
|
|
|
check-failures:
|
|
|
|
name: Check for failures
|
|
|
|
if: always()
|
2022-09-19 22:38:19 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2021-10-14 20:34:31 +02:00
|
|
|
needs:
|
|
|
|
- setup
|
2022-09-19 22:38:19 +02:00
|
|
|
- build-artifacts
|
2022-10-11 16:46:36 +02:00
|
|
|
- build-containers
|
2021-11-04 19:15:29 +01:00
|
|
|
- crowdin-push
|
2024-01-03 16:48:51 +01:00
|
|
|
- trigger-web-vault-deploy
|
2021-10-14 20:34:31 +02:00
|
|
|
steps:
|
|
|
|
- name: Check if any job failed
|
2024-11-07 21:15:44 +01:00
|
|
|
if: |
|
|
|
|
github.event_name != 'pull_request_target'
|
2024-11-11 22:38:03 +01:00
|
|
|
&& (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc-web')
|
2024-11-07 21:15:44 +01:00
|
|
|
&& contains(needs.*.result, 'failure')
|
2024-03-06 14:59:18 +01:00
|
|
|
run: exit 1
|
2021-10-14 20:34:31 +02:00
|
|
|
|
|
|
|
- name: Login to Azure - Prod Subscription
|
2024-02-08 20:38:19 +01:00
|
|
|
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
|
2021-10-14 20:34:31 +02:00
|
|
|
if: failure()
|
|
|
|
with:
|
2023-04-11 18:37:58 +02:00
|
|
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
2021-10-14 20:34:31 +02:00
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
|
|
|
if: failure()
|
2023-11-08 19:08:34 +01:00
|
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
2022-10-13 21:38:47 +02:00
|
|
|
with:
|
2023-04-11 18:37:58 +02:00
|
|
|
keyvault: "bitwarden-ci"
|
2022-10-13 21:38:47 +02:00
|
|
|
secrets: "devops-alerts-slack-webhook-url"
|
2021-10-14 20:34:31 +02:00
|
|
|
|
|
|
|
- name: Notify Slack on failure
|
2024-08-26 22:45:28 +02:00
|
|
|
uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0
|
2021-10-14 20:34:31 +02:00
|
|
|
if: failure()
|
|
|
|
env:
|
|
|
|
SLACK_WEBHOOK_URL: ${{ steps.retrieve-secrets.outputs.devops-alerts-slack-webhook-url }}
|
|
|
|
with:
|
|
|
|
status: ${{ job.status }}
|