2021-09-02 22:05:17 +02:00
|
|
|
---
|
2022-06-03 16:35:46 +02:00
|
|
|
name: Build Web
|
2020-12-21 18:46:36 +01:00
|
|
|
|
|
|
|
on:
|
2022-06-03 16:35:46 +02:00
|
|
|
pull_request:
|
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:
|
|
|
|
- 'master'
|
|
|
|
- 'rc'
|
2022-07-26 22:43:29 +02:00
|
|
|
- 'hotfix-rc'
|
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'
|
|
|
|
workflow_dispatch:
|
2022-06-20 18:23:11 +02:00
|
|
|
inputs:
|
|
|
|
custom_tag_extension:
|
|
|
|
description: "Custom image tag extension"
|
|
|
|
required: false
|
2022-03-08 22:39:54 +01:00
|
|
|
|
2020-12-21 18:46:36 +01:00
|
|
|
jobs:
|
|
|
|
cloc:
|
2021-06-14 21:20:49 +02:00
|
|
|
name: CLOC
|
2021-09-21 18:37:17 +02:00
|
|
|
runs-on: ubuntu-20.04
|
2020-12-21 18:46:36 +01:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
2020-12-21 18:46:36 +01:00
|
|
|
|
|
|
|
- name: Set up cloc
|
|
|
|
run: |
|
|
|
|
sudo apt update
|
|
|
|
sudo apt -y install cloc
|
|
|
|
|
|
|
|
- name: Print lines of code
|
2022-06-03 16:35:46 +02:00
|
|
|
working-directory: apps/web
|
2020-12-21 18:46:36 +01:00
|
|
|
run: cloc --include-lang TypeScript,JavaScript,HTML,Sass,CSS --vcs git
|
|
|
|
|
2022-03-08 22:39:54 +01:00
|
|
|
|
2021-10-08 18:54:42 +02:00
|
|
|
setup:
|
|
|
|
name: Setup
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
outputs:
|
|
|
|
version: ${{ steps.version.outputs.value }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
2021-10-08 18:54:42 +02:00
|
|
|
|
|
|
|
- name: Get GitHub sha as version
|
|
|
|
id: version
|
2021-12-16 17:46:26 +01:00
|
|
|
run: echo "::set-output name=value::${GITHUB_SHA:0:7}"
|
2021-10-08 18:54:42 +02:00
|
|
|
|
2022-03-08 22:39:54 +01:00
|
|
|
|
2021-10-08 18:54:42 +02:00
|
|
|
build-oss-selfhost:
|
|
|
|
name: Build OSS zip
|
2021-09-21 18:37:17 +02:00
|
|
|
runs-on: ubuntu-20.04
|
2022-03-07 17:02:23 +01:00
|
|
|
needs:
|
|
|
|
- setup
|
2021-10-08 18:54:42 +02:00
|
|
|
env:
|
|
|
|
_VERSION: ${{ needs.setup.outputs.version }}
|
2020-12-21 18:46:36 +01:00
|
|
|
steps:
|
2022-03-17 14:02:50 +01:00
|
|
|
- name: Checkout repo
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
2022-03-17 14:02:50 +01:00
|
|
|
|
2020-12-21 18:46:36 +01:00
|
|
|
- name: Set up Node
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3.1.1
|
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'
|
2021-12-13 17:16:57 +01:00
|
|
|
node-version: "16"
|
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
|
|
|
|
gulp --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
|
|
|
|
2021-10-08 18:54:42 +02:00
|
|
|
- name: Build OSS selfhost
|
2022-06-03 16:35:46 +02:00
|
|
|
working-directory: apps/web
|
2021-09-21 18:37:17 +02:00
|
|
|
run: |
|
2021-10-08 18:54:42 +02:00
|
|
|
npm run dist:oss:selfhost
|
|
|
|
zip -r web-$_VERSION-selfhosted-open-source.zip build
|
2021-09-21 18:37:17 +02:00
|
|
|
|
2021-10-08 18:54:42 +02:00
|
|
|
- name: Upload build artifact
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # v3.0.0
|
2021-10-08 18:54:42 +02:00
|
|
|
with:
|
|
|
|
name: web-${{ env._VERSION }}-selfhosted-open-source.zip
|
2022-06-03 16:35:46 +02:00
|
|
|
path: apps/web/web-${{ env._VERSION }}-selfhosted-open-source.zip
|
2021-10-08 18:54:42 +02:00
|
|
|
if-no-files-found: error
|
2020-12-21 18:46:36 +01:00
|
|
|
|
2022-03-08 22:39:54 +01:00
|
|
|
|
2021-09-21 18:37:17 +02:00
|
|
|
build-cloud:
|
|
|
|
name: Build Cloud zip
|
|
|
|
runs-on: ubuntu-20.04
|
2022-03-07 17:02:23 +01:00
|
|
|
needs:
|
|
|
|
- setup
|
2021-10-08 18:54:42 +02:00
|
|
|
env:
|
|
|
|
_VERSION: ${{ needs.setup.outputs.version }}
|
2021-06-14 21:20:49 +02:00
|
|
|
steps:
|
2022-03-17 14:02:50 +01:00
|
|
|
- name: Checkout repo
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
2022-03-17 14:02:50 +01:00
|
|
|
|
2021-06-14 21:20:49 +02:00
|
|
|
- name: Set up Node
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3.1.1
|
2021-06-14 21:20:49 +02:00
|
|
|
with:
|
2022-03-16 16:18:47 +01:00
|
|
|
cache: 'npm'
|
|
|
|
cache-dependency-path: '**/package-lock.json'
|
2021-12-13 17:16:57 +01:00
|
|
|
node-version: "16"
|
2021-06-14 21:20:49 +02:00
|
|
|
|
|
|
|
- name: Print environment
|
|
|
|
run: |
|
|
|
|
whoami
|
|
|
|
node --version
|
|
|
|
npm --version
|
|
|
|
gulp --version
|
|
|
|
docker --version
|
|
|
|
echo "GitHub ref: $GITHUB_REF"
|
|
|
|
echo "GitHub event: $GITHUB_EVENT"
|
2021-10-08 18:54:42 +02:00
|
|
|
|
2021-09-21 18:37:17 +02:00
|
|
|
- name: Install dependencies
|
|
|
|
run: npm ci
|
|
|
|
|
|
|
|
- name: Build Cloud
|
2022-06-03 16:35:46 +02:00
|
|
|
working-directory: apps/web
|
2021-09-21 18:37:17 +02:00
|
|
|
run: |
|
|
|
|
npm run dist:bit:cloud
|
2021-10-08 18:54:42 +02:00
|
|
|
zip -r web-$_VERSION-cloud-COMMERCIAL.zip build
|
2021-09-21 18:37:17 +02:00
|
|
|
|
|
|
|
- name: Upload build artifact
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # v3.0.0
|
2021-06-14 21:20:49 +02:00
|
|
|
with:
|
2021-10-08 18:54:42 +02:00
|
|
|
name: web-${{ env._VERSION }}-cloud-COMMERCIAL.zip
|
2022-06-03 16:35:46 +02:00
|
|
|
path: apps/web/web-${{ env._VERSION }}-cloud-COMMERCIAL.zip
|
2021-09-21 18:37:17 +02:00
|
|
|
if-no-files-found: error
|
2021-06-14 21:20:49 +02:00
|
|
|
|
2022-03-08 22:39:54 +01:00
|
|
|
|
2021-10-08 18:54:42 +02:00
|
|
|
build-commercial-selfhost:
|
2021-09-21 18:37:17 +02:00
|
|
|
name: Build SelfHost Docker image
|
|
|
|
runs-on: ubuntu-20.04
|
2022-03-07 17:02:23 +01:00
|
|
|
needs:
|
|
|
|
- setup
|
2021-10-08 18:54:42 +02:00
|
|
|
env:
|
|
|
|
_VERSION: ${{ needs.setup.outputs.version }}
|
2021-09-21 18:37:17 +02:00
|
|
|
steps:
|
2022-03-17 14:02:50 +01:00
|
|
|
- name: Checkout repo
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
2022-03-17 14:02:50 +01:00
|
|
|
|
2021-09-21 18:37:17 +02:00
|
|
|
- name: Set up Node
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3.1.1
|
2021-09-21 18:37:17 +02:00
|
|
|
with:
|
2022-03-16 16:18:47 +01:00
|
|
|
cache: 'npm'
|
|
|
|
cache-dependency-path: '**/package-lock.json'
|
2021-12-13 17:16:57 +01:00
|
|
|
node-version: "16"
|
2021-09-21 18:37:17 +02:00
|
|
|
|
|
|
|
- name: Print environment
|
|
|
|
run: |
|
|
|
|
whoami
|
|
|
|
node --version
|
|
|
|
npm --version
|
|
|
|
gulp --version
|
|
|
|
docker --version
|
|
|
|
echo "GitHub ref: $GITHUB_REF"
|
|
|
|
echo "GitHub event: $GITHUB_EVENT"
|
|
|
|
|
|
|
|
- name: Setup DCT
|
2022-03-09 21:46:20 +01:00
|
|
|
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc'
|
2021-09-21 18:37:17 +02:00
|
|
|
id: setup-dct
|
|
|
|
uses: bitwarden/gh-actions/setup-docker-trust@a8c384a05a974c05c48374c818b004be221d43ff
|
|
|
|
with:
|
|
|
|
azure-creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
|
|
|
azure-keyvault-name: "bitwarden-prod-kv"
|
2021-06-14 21:20:49 +02:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: npm ci
|
|
|
|
|
|
|
|
- name: Build
|
2022-06-03 16:35:46 +02:00
|
|
|
working-directory: apps/web
|
2021-06-14 21:20:49 +02:00
|
|
|
run: |
|
|
|
|
echo -e "# Building Web\n"
|
|
|
|
echo "Building app"
|
|
|
|
echo "npm version $(npm --version)"
|
2021-09-08 19:08:31 +02:00
|
|
|
|
2021-09-21 18:37:17 +02:00
|
|
|
npm run dist:bit:selfhost
|
2021-10-08 18:54:42 +02:00
|
|
|
zip -r web-$_VERSION-selfhosted-COMMERCIAL.zip build
|
2021-06-14 21:20:49 +02:00
|
|
|
|
2021-10-08 18:54:42 +02:00
|
|
|
- name: Upload build artifact
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # v3.0.0
|
2021-10-08 18:54:42 +02:00
|
|
|
with:
|
|
|
|
name: web-${{ env._VERSION }}-selfhosted-COMMERCIAL.zip
|
2022-06-03 16:35:46 +02:00
|
|
|
path: apps/web/web-${{ env._VERSION }}-selfhosted-COMMERCIAL.zip
|
2021-10-08 18:54:42 +02:00
|
|
|
if-no-files-found: error
|
2021-09-08 19:08:31 +02:00
|
|
|
|
2021-10-08 18:54:42 +02:00
|
|
|
- name: Build Docker image
|
2022-06-03 16:35:46 +02:00
|
|
|
working-directory: apps/web
|
2021-10-08 18:54:42 +02:00
|
|
|
run: |
|
2021-06-14 21:20:49 +02:00
|
|
|
echo -e "\nBuilding Docker image"
|
|
|
|
docker --version
|
2021-09-21 18:37:17 +02:00
|
|
|
docker build -t bitwarden/web .
|
2021-08-10 16:28:21 +02:00
|
|
|
|
2021-09-21 18:37:17 +02:00
|
|
|
- name: Tag rc branch
|
|
|
|
if: github.ref == 'refs/heads/rc'
|
|
|
|
run: docker tag bitwarden/web bitwarden/web:rc
|
2021-06-14 21:20:49 +02:00
|
|
|
|
|
|
|
- name: Tag dev
|
|
|
|
if: github.ref == 'refs/heads/master'
|
2021-09-21 18:37:17 +02:00
|
|
|
run: docker tag bitwarden/web bitwarden/web:dev
|
2021-06-14 21:20:49 +02:00
|
|
|
|
2021-12-16 17:46:26 +01:00
|
|
|
- name: Tag hotfix branch
|
2022-03-09 21:46:20 +01:00
|
|
|
if: github.ref == 'refs/heads/hotfix-rc'
|
|
|
|
run: docker tag bitwarden/web bitwarden/web:hotfix-rc
|
2021-10-21 19:31:41 +02:00
|
|
|
|
2021-06-14 21:20:49 +02:00
|
|
|
- name: List Docker images
|
2022-03-09 21:46:20 +01:00
|
|
|
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc'
|
2021-06-14 21:20:49 +02:00
|
|
|
run: docker images
|
|
|
|
|
2021-10-21 19:31:41 +02:00
|
|
|
- name: Push rc image
|
2021-09-21 18:37:17 +02:00
|
|
|
if: github.ref == 'refs/heads/rc'
|
|
|
|
run: docker push bitwarden/web:rc
|
2021-08-10 16:28:21 +02:00
|
|
|
env:
|
2021-09-21 18:37:17 +02:00
|
|
|
DOCKER_CONTENT_TRUST: 1
|
|
|
|
DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ steps.setup-dct.outputs.dct-delegate-repo-passphrase }}
|
2021-06-14 21:20:49 +02:00
|
|
|
|
2021-10-21 19:31:41 +02:00
|
|
|
- name: Push dev image
|
2021-06-14 21:20:49 +02:00
|
|
|
if: github.ref == 'refs/heads/master'
|
2021-09-21 18:37:17 +02:00
|
|
|
run: docker push bitwarden/web:dev
|
|
|
|
env:
|
|
|
|
DOCKER_CONTENT_TRUST: 1
|
|
|
|
DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ steps.setup-dct.outputs.dct-delegate-repo-passphrase }}
|
2021-06-14 21:20:49 +02:00
|
|
|
|
2021-12-16 17:46:26 +01:00
|
|
|
- name: Push hotfix image
|
2022-03-09 21:46:20 +01:00
|
|
|
if: github.ref == 'refs/heads/hotfix-rc'
|
|
|
|
run: docker push bitwarden/web:hotfix-rc
|
2021-10-21 19:31:41 +02:00
|
|
|
env:
|
|
|
|
DOCKER_CONTENT_TRUST: 1
|
|
|
|
DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ steps.setup-dct.outputs.dct-delegate-repo-passphrase }}
|
|
|
|
|
2021-06-14 21:20:49 +02:00
|
|
|
- name: Log out of Docker
|
2022-03-09 21:46:20 +01:00
|
|
|
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc'
|
2022-03-08 22:39:54 +01:00
|
|
|
run: |
|
|
|
|
docker logout
|
|
|
|
echo "DOCKER_CONTENT_TRUST=0" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Login to Azure - QA Subscription
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: Azure/login@ec3c14589bd3e9312b3cc8c41e6860e258df9010 # v1.1
|
2022-03-08 22:39:54 +01:00
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_QA_KV_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Login to Azure ACR
|
|
|
|
run: az acr login -n bitwardenqa
|
|
|
|
|
|
|
|
- name: Tag and Push RC to Azure ACR QA registry
|
|
|
|
env:
|
|
|
|
REGISTRY: bitwardenqa.azurecr.io
|
|
|
|
run: |
|
|
|
|
IMAGE_TAG=$(echo "${GITHUB_REF:11}" | sed "s#/#-#g") # slash safe branch name
|
|
|
|
if [[ "$IMAGE_TAG" == "master" ]]; then
|
|
|
|
IMAGE_TAG=dev
|
|
|
|
fi
|
|
|
|
docker tag bitwarden/web \
|
|
|
|
$REGISTRY/web-sh:$IMAGE_TAG
|
|
|
|
docker push $REGISTRY/web-sh:$IMAGE_TAG
|
|
|
|
|
|
|
|
- name: Log out of Docker
|
2021-06-14 21:20:49 +02:00
|
|
|
run: docker logout
|
|
|
|
|
2022-03-08 22:39:54 +01:00
|
|
|
|
2021-10-08 18:54:42 +02:00
|
|
|
build-qa:
|
|
|
|
name: Build Docker images for QA environment
|
|
|
|
runs-on: ubuntu-20.04
|
2022-03-07 17:02:23 +01:00
|
|
|
needs:
|
|
|
|
- setup
|
2021-10-08 18:54:42 +02:00
|
|
|
steps:
|
2022-03-17 14:02:50 +01:00
|
|
|
- name: Checkout repo
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
2022-03-17 14:02:50 +01:00
|
|
|
|
2021-10-08 18:54:42 +02:00
|
|
|
- name: Set up Node
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3.1.1
|
2021-10-08 18:54:42 +02:00
|
|
|
with:
|
2022-03-16 16:18:47 +01:00
|
|
|
cache: 'npm'
|
|
|
|
cache-dependency-path: '**/package-lock.json'
|
2021-12-13 17:16:57 +01:00
|
|
|
node-version: "16"
|
2021-10-08 18:54:42 +02:00
|
|
|
|
|
|
|
- name: Print environment
|
|
|
|
run: |
|
|
|
|
whoami
|
|
|
|
node --version
|
|
|
|
npm --version
|
|
|
|
gulp --version
|
|
|
|
docker --version
|
|
|
|
echo "GitHub ref: $GITHUB_REF"
|
|
|
|
echo "GitHub event: $GITHUB_EVENT"
|
|
|
|
|
|
|
|
- name: Login to Azure
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: Azure/login@ec3c14589bd3e9312b3cc8c41e6860e258df9010 # v1.1
|
2021-10-08 18:54:42 +02:00
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_QA_KV_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Log into container registry
|
|
|
|
run: az acr login -n bitwardenqa
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: npm ci
|
|
|
|
|
|
|
|
- name: Build
|
2022-06-03 16:35:46 +02:00
|
|
|
working-directory: apps/web
|
2021-10-08 18:54:42 +02:00
|
|
|
run: |
|
|
|
|
echo -e "# Building Web\n"
|
|
|
|
echo "Building app"
|
|
|
|
echo "npm version $(npm --version)"
|
|
|
|
VERSION=$( jq -r ".version" package.json)
|
|
|
|
jq --arg version "$VERSION - ${GITHUB_SHA:0:7}" '.version = $version' package.json > package.json.tmp
|
|
|
|
mv package.json.tmp package.json
|
|
|
|
|
|
|
|
npm run build:bit:qa
|
|
|
|
|
|
|
|
echo "{\"commit_hash\": \"$GITHUB_SHA\", \"ref\": \"$GITHUB_REF\"}" | jq . > build/info.json
|
|
|
|
|
|
|
|
echo -e "\nBuilding Docker image"
|
|
|
|
docker --version
|
|
|
|
docker build -t bitwardenqa.azurecr.io/web .
|
|
|
|
|
2021-12-23 15:14:10 +01:00
|
|
|
- name: Get image tag
|
|
|
|
id: image-tag
|
|
|
|
run: |
|
|
|
|
IMAGE_TAG=$(echo "${GITHUB_REF:11}" | sed "s#/#-#g")
|
|
|
|
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
|
|
|
|
echo "::set-output name=value::$IMAGE_TAG"
|
2021-10-08 18:54:42 +02:00
|
|
|
|
2021-12-23 15:14:10 +01:00
|
|
|
- name: Tag image
|
|
|
|
env:
|
|
|
|
IMAGE_TAG: ${{ steps.image-tag.outputs.value }}
|
|
|
|
run: docker tag bitwardenqa.azurecr.io/web "bitwardenqa.azurecr.io/web:$IMAGE_TAG"
|
2021-10-08 18:54:42 +02:00
|
|
|
|
|
|
|
- name: Tag dev
|
|
|
|
if: github.ref == 'refs/heads/master'
|
|
|
|
run: docker tag bitwardenqa.azurecr.io/web bitwardenqa.azurecr.io/web:dev
|
|
|
|
|
|
|
|
- name: List Docker images
|
|
|
|
run: docker images
|
|
|
|
|
2021-12-23 15:14:10 +01:00
|
|
|
- name: Push image
|
|
|
|
env:
|
|
|
|
IMAGE_TAG: ${{ steps.image-tag.outputs.value }}
|
|
|
|
run: docker push "bitwardenqa.azurecr.io/web:$IMAGE_TAG"
|
2021-10-08 18:54:42 +02:00
|
|
|
|
|
|
|
- name: Push dev images
|
|
|
|
if: github.ref == 'refs/heads/master'
|
|
|
|
run: docker push bitwardenqa.azurecr.io/web:dev
|
|
|
|
|
|
|
|
- name: Log out of Docker
|
|
|
|
run: docker logout
|
|
|
|
|
2021-11-04 19:15:29 +01:00
|
|
|
crowdin-push:
|
|
|
|
name: Crowdin Push
|
|
|
|
if: github.ref == 'refs/heads/master'
|
|
|
|
needs:
|
|
|
|
- build-oss-selfhost
|
|
|
|
- build-cloud
|
|
|
|
- build-commercial-selfhost
|
|
|
|
- build-qa
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 # v2.3.4
|
2021-11-04 19:15:29 +01:00
|
|
|
|
|
|
|
- name: Login to Azure
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: Azure/login@ec3c14589bd3e9312b3cc8c41e6860e258df9010 # v1.1
|
2021-11-04 19:15:29 +01:00
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: Azure/get-keyvault-secrets@b5c723b9ac7870c022b8c35befe620b7009b336f # v1.0.0
|
2021-11-04 19:15:29 +01:00
|
|
|
with:
|
|
|
|
keyvault: "bitwarden-prod-kv"
|
|
|
|
secrets: "crowdin-api-token"
|
|
|
|
|
|
|
|
- name: Upload Sources
|
2022-06-07 21:31:53 +02:00
|
|
|
uses: crowdin/github-action@ecd7eb0ef6f3cfa16293c79e9cbc4bc5b5fd9c49 # v1.4.9
|
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
|
2021-11-04 19:15:29 +01:00
|
|
|
crowdin_branch_name: master
|
|
|
|
upload_sources: true
|
|
|
|
upload_translations: false
|
|
|
|
|
2022-03-08 22:39:54 +01:00
|
|
|
|
2021-10-14 20:34:31 +02:00
|
|
|
check-failures:
|
|
|
|
name: Check for failures
|
|
|
|
if: always()
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
needs:
|
|
|
|
- cloc
|
|
|
|
- setup
|
|
|
|
- build-oss-selfhost
|
|
|
|
- build-cloud
|
|
|
|
- build-commercial-selfhost
|
|
|
|
- build-qa
|
2021-11-04 19:15:29 +01:00
|
|
|
- crowdin-push
|
2021-10-14 20:34:31 +02:00
|
|
|
steps:
|
|
|
|
- name: Check if any job failed
|
2021-10-15 19:06:59 +02:00
|
|
|
if: ${{ (github.ref == 'refs/heads/master') || (github.ref == 'refs/heads/rc') }}
|
2021-10-14 20:34:31 +02:00
|
|
|
env:
|
|
|
|
CLOC_STATUS: ${{ needs.cloc.result }}
|
|
|
|
SETUP_STATUS: ${{ needs.setup.result }}
|
|
|
|
BUILD_OSS_SELFHOST_STATUS: ${{ needs.build-oss-selfhost.result }}
|
|
|
|
BUILD_CLOUD_STATUS: ${{ needs.build-cloud.result }}
|
|
|
|
BUILD_COMMERCIAL_SELFHOST_STATUS: ${{ needs.build-commercial-selfhost.result }}
|
2021-11-04 19:15:29 +01:00
|
|
|
BUILD_QA_STATUS: ${{ needs.build-qa.result }}
|
|
|
|
CROWDIN_PUSH_STATUS: ${{ needs.crowdin-push.result }}
|
2021-10-14 20:34:31 +02:00
|
|
|
run: |
|
|
|
|
if [ "$CLOC_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
|
|
|
elif [ "$SETUP_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
|
|
|
elif [ "$BUILD_OSS_SELFHOST_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
|
|
|
elif [ "$BUILD_CLOUD_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
|
|
|
elif [ "$BUILD_COMMERCIAL_SELFHOST_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
2021-11-04 19:15:29 +01:00
|
|
|
elif [ "$BUILD_QA_STATUS" = "failure" ]; then
|
|
|
|
exit 1
|
|
|
|
elif [ "$CROWDIN_PUSH_STATUS" = "failure" ]; then
|
2021-10-14 20:34:31 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Login to Azure - Prod Subscription
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: Azure/login@ec3c14589bd3e9312b3cc8c41e6860e258df9010 # v1.1
|
2021-10-14 20:34:31 +02:00
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: Azure/get-keyvault-secrets@b5c723b9ac7870c022b8c35befe620b7009b336f # v1.0.0
|
2021-10-14 20:34:31 +02:00
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
keyvault: "bitwarden-prod-kv"
|
|
|
|
secrets: "devops-alerts-slack-webhook-url"
|
|
|
|
|
|
|
|
- name: Notify Slack on failure
|
2022-06-03 16:35:46 +02:00
|
|
|
uses: act10ns/slack@da3191ebe2e67f49b46880b4633f5591a96d1d33 # v1.5.1
|
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 }}
|