2021-09-02 22:03:28 +02:00
|
|
|
---
|
2021-05-04 22:41:49 +02:00
|
|
|
name: Release
|
2022-11-08 21:26:47 +01:00
|
|
|
run-name: Release ${{ inputs.release_type }}
|
2021-05-04 22:41:49 +02:00
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2021-12-20 21:19:18 +01:00
|
|
|
inputs:
|
|
|
|
release_type:
|
|
|
|
description: 'Release Options'
|
|
|
|
required: true
|
|
|
|
default: 'Initial Release'
|
|
|
|
type: choice
|
|
|
|
options:
|
|
|
|
- Initial Release
|
|
|
|
- Redeploy
|
2022-02-24 14:55:43 +01:00
|
|
|
- Dry Run
|
2021-10-20 00:13:42 +02:00
|
|
|
|
2021-05-04 22:41:49 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
setup:
|
2021-05-27 16:32:36 +02:00
|
|
|
name: Setup
|
2021-09-25 00:04:14 +02:00
|
|
|
runs-on: ubuntu-20.04
|
2021-05-04 22:41:49 +02:00
|
|
|
outputs:
|
2022-06-01 03:08:56 +02:00
|
|
|
release_version: ${{ steps.version.outputs.version }}
|
2021-11-08 19:39:32 +01:00
|
|
|
branch-name: ${{ steps.branch.outputs.branch-name }}
|
2021-05-04 22:41:49 +02:00
|
|
|
steps:
|
2021-10-22 17:41:38 +02:00
|
|
|
- name: Branch check
|
2022-02-24 14:55:43 +01:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
2021-10-22 17:41:38 +02:00
|
|
|
run: |
|
2022-02-09 17:17:17 +01:00
|
|
|
if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then
|
2021-10-22 17:41:38 +02:00
|
|
|
echo "==================================="
|
2022-02-09 17:17:17 +01:00
|
|
|
echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches"
|
2021-10-22 17:41:38 +02:00
|
|
|
echo "==================================="
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-05-04 22:41:49 +02:00
|
|
|
- name: Checkout repo
|
2022-02-24 14:55:43 +01:00
|
|
|
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
|
2021-05-04 22:41:49 +02:00
|
|
|
|
2021-09-25 00:04:14 +02:00
|
|
|
- name: Check Release Version
|
|
|
|
id: version
|
2022-06-28 22:54:49 +02:00
|
|
|
uses: bitwarden/gh-actions/release-version-check@4cf17a5ff15a995a2daf2b60ba371e5c9907c068
|
2022-06-01 01:11:21 +02:00
|
|
|
with:
|
|
|
|
release-type: ${{ github.event.inputs.release_type }}
|
2022-06-28 22:54:49 +02:00
|
|
|
project-type: dotnet
|
2022-06-01 01:11:21 +02:00
|
|
|
file: Directory.Build.props
|
2021-05-04 22:41:49 +02:00
|
|
|
|
2021-11-08 19:39:32 +01:00
|
|
|
- name: Get branch name
|
|
|
|
id: branch
|
|
|
|
run: |
|
|
|
|
BRANCH_NAME=$(basename ${{ github.ref }})
|
|
|
|
echo "::set-output name=branch-name::$BRANCH_NAME"
|
|
|
|
|
2021-09-25 00:04:14 +02:00
|
|
|
|
|
|
|
deploy:
|
|
|
|
name: Deploy
|
|
|
|
runs-on: ubuntu-20.04
|
2021-09-02 22:03:28 +02:00
|
|
|
needs:
|
2021-06-01 22:16:06 +02:00
|
|
|
- setup
|
2021-09-25 00:04:14 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- name: Api
|
|
|
|
- name: Admin
|
|
|
|
- name: Billing
|
|
|
|
- name: Events
|
|
|
|
- name: Sso
|
|
|
|
- name: Identity
|
2021-05-27 16:32:36 +02:00
|
|
|
steps:
|
2021-09-25 00:04:14 +02:00
|
|
|
- name: Setup
|
|
|
|
id: setup
|
2021-05-04 22:41:49 +02:00
|
|
|
run: |
|
2021-09-25 00:04:14 +02:00
|
|
|
NAME_LOWER=$(echo "${{ matrix.name }}" | awk '{print tolower($0)}')
|
|
|
|
echo "Matrix name: ${{ matrix.name }}"
|
|
|
|
echo "NAME_LOWER: $NAME_LOWER"
|
|
|
|
echo "::set-output name=name_lower::$NAME_LOWER"
|
2021-05-04 22:41:49 +02:00
|
|
|
|
2022-07-25 23:19:56 +02:00
|
|
|
- name: Create GitHub deployment for ${{ matrix.name }}
|
|
|
|
uses: chrnorm/deployment-action@1b599fe41a0ef1f95191e7f2eec4743f2d7dfc48
|
|
|
|
id: deployment
|
|
|
|
with:
|
|
|
|
token: '${{ secrets.GITHUB_TOKEN }}'
|
2022-08-03 17:39:35 +02:00
|
|
|
initial-status: 'in_progress'
|
2022-07-25 23:19:56 +02:00
|
|
|
environment: 'Server ${{ matrix.name }} - Production'
|
|
|
|
task: 'deploy'
|
|
|
|
description: 'Deploy from ${{ needs.setup.outputs.branch-name }} branch'
|
|
|
|
|
2021-10-22 17:41:38 +02:00
|
|
|
- name: Download latest Release ${{ matrix.name }} asset
|
2022-07-19 21:00:57 +02:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
2022-09-28 14:50:43 +02:00
|
|
|
uses: bitwarden/gh-actions/download-artifacts@850faad0cf6c02a8c0dc46eddde2363fbd6c373a
|
2021-05-04 22:41:49 +02:00
|
|
|
with:
|
2021-09-25 00:04:14 +02:00
|
|
|
workflow: build.yml
|
|
|
|
workflow_conclusion: success
|
2021-11-08 19:39:32 +01:00
|
|
|
branch: ${{ needs.setup.outputs.branch-name }}
|
2021-09-28 00:30:20 +02:00
|
|
|
artifacts: ${{ matrix.name }}.zip
|
2021-05-04 22:41:49 +02:00
|
|
|
|
2022-07-19 21:00:57 +02:00
|
|
|
- name: Download latest Release ${{ matrix.name }} asset
|
|
|
|
if: ${{ github.event.inputs.release_type == 'Dry Run' }}
|
2022-09-28 14:50:43 +02:00
|
|
|
uses: bitwarden/gh-actions/download-artifacts@850faad0cf6c02a8c0dc46eddde2363fbd6c373a
|
2022-07-19 21:00:57 +02:00
|
|
|
with:
|
|
|
|
workflow: build.yml
|
|
|
|
workflow_conclusion: success
|
|
|
|
branch: master
|
|
|
|
artifacts: ${{ matrix.name }}.zip
|
|
|
|
|
2021-09-25 00:04:14 +02:00
|
|
|
- name: Login to Azure
|
2022-02-24 14:55:43 +01:00
|
|
|
uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf
|
2021-09-25 00:04:14 +02:00
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
2021-05-04 22:41:49 +02:00
|
|
|
|
2021-09-25 00:04:14 +02:00
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2021-05-04 22:41:49 +02:00
|
|
|
env:
|
2021-09-25 00:04:14 +02:00
|
|
|
VAULT_NAME: "bitwarden-prod-kv"
|
|
|
|
run: |
|
|
|
|
webapp_name=$(
|
|
|
|
az keyvault secret show --vault-name $VAULT_NAME \
|
|
|
|
--name appservices-${{ steps.setup.outputs.name_lower }}-webapp-name \
|
|
|
|
--query value --output tsv
|
|
|
|
)
|
2021-10-27 17:45:33 +02:00
|
|
|
publish_profile=$(
|
|
|
|
az keyvault secret show --vault-name $VAULT_NAME \
|
|
|
|
--name appservices-${{ steps.setup.outputs.name_lower }}-webapp-publish-profile \
|
|
|
|
--query value --output tsv
|
|
|
|
)
|
2021-09-25 00:04:14 +02:00
|
|
|
echo "::add-mask::$webapp_name"
|
|
|
|
echo "::set-output name=webapp-name::$webapp_name"
|
2021-10-27 17:45:33 +02:00
|
|
|
echo "::add-mask::$publish_profile"
|
|
|
|
echo "::set-output name=publish-profile::$publish_profile"
|
2021-05-04 22:41:49 +02:00
|
|
|
|
2021-09-25 00:04:14 +02:00
|
|
|
- name: Deploy App
|
2022-02-24 14:55:43 +01:00
|
|
|
uses: azure/webapps-deploy@0b651ed7546ecfc75024011f76944cb9b381ef1e
|
2021-05-04 22:41:49 +02:00
|
|
|
with:
|
2021-09-25 00:04:14 +02:00
|
|
|
app-name: ${{ steps.retrieve-secrets.outputs.webapp-name }}
|
2021-10-27 17:45:33 +02:00
|
|
|
publish-profile: ${{ steps.retrieve-secrets.outputs.publish-profile }}
|
2021-09-25 00:04:14 +02:00
|
|
|
package: ./${{ matrix.name }}.zip
|
2021-10-27 04:18:54 +02:00
|
|
|
slot-name: "staging"
|
2021-05-04 22:41:49 +02:00
|
|
|
|
2022-03-09 16:47:09 +01:00
|
|
|
- name: Start staging slot
|
2022-07-19 21:00:57 +02:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
2022-03-15 14:41:01 +01:00
|
|
|
env:
|
|
|
|
SERVICE: ${{ matrix.name }}
|
|
|
|
WEBAPP_NAME: ${{ steps.retrieve-secrets.outputs.webapp-name }}
|
|
|
|
run: |
|
|
|
|
if [[ "$SERVICE" = "Api" ]] || [[ "$SERVICE" = "Identity" ]]; then
|
|
|
|
RESOURCE_GROUP=bitwardenappservices
|
|
|
|
else
|
|
|
|
RESOURCE_GROUP=bitwarden
|
|
|
|
fi
|
|
|
|
az webapp start -n $WEBAPP_NAME -g $RESOURCE_GROUP -s staging
|
2022-03-09 16:47:09 +01:00
|
|
|
|
2022-07-25 23:19:56 +02:00
|
|
|
- name: Update ${{ matrix.name }} deployment status to Success
|
2022-08-03 17:39:35 +02:00
|
|
|
if: ${{ success() }}
|
2022-07-25 23:19:56 +02:00
|
|
|
uses: chrnorm/deployment-status@07b3930847f65e71c9c6802ff5a402f6dfb46b86
|
|
|
|
with:
|
|
|
|
token: '${{ secrets.GITHUB_TOKEN }}'
|
|
|
|
state: 'success'
|
|
|
|
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
|
|
|
|
|
|
|
|
- name: Update ${{ matrix.name }} deployment status to Failure
|
2022-08-03 17:39:35 +02:00
|
|
|
if: ${{ failure() }}
|
2022-07-25 23:19:56 +02:00
|
|
|
uses: chrnorm/deployment-status@07b3930847f65e71c9c6802ff5a402f6dfb46b86
|
|
|
|
with:
|
|
|
|
token: '${{ secrets.GITHUB_TOKEN }}'
|
|
|
|
state: 'failure'
|
|
|
|
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
|
|
|
|
|
2021-09-25 00:04:14 +02:00
|
|
|
|
2021-10-22 17:41:38 +02:00
|
|
|
release-docker:
|
|
|
|
name: Build Docker images
|
|
|
|
runs-on: ubuntu-20.04
|
2021-11-15 19:23:51 +01:00
|
|
|
needs:
|
|
|
|
- setup
|
2021-10-22 17:41:38 +02:00
|
|
|
env:
|
|
|
|
_RELEASE_VERSION: ${{ needs.setup.outputs.release_version }}
|
2021-11-08 19:39:32 +01:00
|
|
|
_BRANCH_NAME: ${{ needs.setup.outputs.branch-name }}
|
2021-10-22 17:41:38 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- service_name: Admin
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2021-10-22 17:41:38 +02:00
|
|
|
- service_name: Api
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2021-10-22 17:41:38 +02:00
|
|
|
- service_name: Attachments
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2021-10-22 17:41:38 +02:00
|
|
|
- service_name: Events
|
2022-08-25 10:02:24 +02:00
|
|
|
prod_acr: true
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
|
|
|
- service_name: EventsProcessor
|
|
|
|
prod_acr: true
|
|
|
|
origin_docker_repo: bitwardenqa.azurecr.io
|
2021-10-22 17:41:38 +02:00
|
|
|
- service_name: Icons
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2022-08-25 10:02:24 +02:00
|
|
|
prod_acr: true
|
2021-10-22 17:41:38 +02:00
|
|
|
- service_name: Identity
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2021-10-22 17:41:38 +02:00
|
|
|
- service_name: K8S-Proxy
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2021-10-22 17:41:38 +02:00
|
|
|
- service_name: MsSql
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2021-10-22 17:41:38 +02:00
|
|
|
- service_name: Nginx
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2021-10-22 17:41:38 +02:00
|
|
|
- service_name: Notifications
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2021-10-22 17:41:38 +02:00
|
|
|
- service_name: Server
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2021-10-22 17:41:38 +02:00
|
|
|
- service_name: Setup
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2021-10-22 17:41:38 +02:00
|
|
|
- service_name: Sso
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2022-07-20 18:47:19 +02:00
|
|
|
- service_name: Scim
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2022-07-21 16:36:40 +02:00
|
|
|
skip_dct: true
|
2021-10-22 17:41:38 +02:00
|
|
|
steps:
|
|
|
|
- name: Print environment
|
2022-02-24 14:55:43 +01:00
|
|
|
env:
|
|
|
|
RELEASE_OPTION: ${{ github.event.inputs.release_type }}
|
2021-10-22 17:41:38 +02:00
|
|
|
run: |
|
|
|
|
whoami
|
|
|
|
docker --version
|
|
|
|
echo "GitHub ref: $GITHUB_REF"
|
|
|
|
echo "GitHub event: $GITHUB_EVENT"
|
2022-02-24 14:55:43 +01:00
|
|
|
echo "Github Release Option: $RELEASE_OPTION"
|
2021-10-22 17:41:38 +02:00
|
|
|
|
|
|
|
- name: Checkout repo
|
2022-02-24 14:55:43 +01:00
|
|
|
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
|
2021-10-22 17:41:38 +02:00
|
|
|
|
|
|
|
- name: Setup service name
|
|
|
|
id: setup
|
|
|
|
run: |
|
|
|
|
SERVICE_NAME=$(echo "${{ matrix.service_name }}" | awk '{print tolower($0)}')
|
|
|
|
echo "Matrix name: ${{ matrix.service_name }}"
|
|
|
|
echo "SERVICE_NAME: $SERVICE_NAME"
|
|
|
|
echo "::set-output name=service_name::$SERVICE_NAME"
|
|
|
|
|
2022-03-03 20:00:49 +01:00
|
|
|
########## DockerHub ##########
|
|
|
|
- name: Setup DCT
|
|
|
|
id: setup-dct
|
2022-09-15 17:21:00 +02:00
|
|
|
if: matrix.origin_docker_repo == 'bitwarden'
|
2022-03-03 20:00:49 +01:00
|
|
|
uses: bitwarden/gh-actions/setup-docker-trust@a8c384a05a974c05c48374c818b004be221d43ff
|
|
|
|
with:
|
|
|
|
azure-creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
|
|
|
azure-keyvault-name: "bitwarden-prod-kv"
|
|
|
|
|
2022-07-21 16:36:40 +02:00
|
|
|
- name: Check for DCT value
|
|
|
|
id: check-matrix-dct
|
2022-09-15 17:21:00 +02:00
|
|
|
if: matrix.origin_docker_repo == 'bitwarden'
|
2022-07-21 16:36:40 +02:00
|
|
|
run: |
|
|
|
|
if [[ "${{ matrix.skip_dct }}" == "true" ]]; then
|
|
|
|
echo "::set-output name=dct_enabled::0"
|
|
|
|
else
|
|
|
|
echo "::set-output name=dct_enabled::1"
|
|
|
|
fi
|
|
|
|
|
2021-11-08 19:39:32 +01:00
|
|
|
- name: Pull latest selfhost image
|
2022-09-15 17:21:00 +02:00
|
|
|
if: matrix.origin_docker_repo == 'bitwarden'
|
2021-11-08 19:39:32 +01:00
|
|
|
env:
|
|
|
|
SERVICE_NAME: ${{ steps.setup.outputs.service_name }}
|
2022-02-24 14:55:43 +01:00
|
|
|
run: |
|
|
|
|
if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then
|
|
|
|
docker pull bitwarden/$SERVICE_NAME:latest
|
|
|
|
else
|
|
|
|
docker pull bitwarden/$SERVICE_NAME:$_BRANCH_NAME
|
|
|
|
fi
|
2021-10-22 17:41:38 +02:00
|
|
|
|
2021-11-08 19:39:32 +01:00
|
|
|
- name: Tag version and latest
|
2022-09-15 17:21:00 +02:00
|
|
|
if: matrix.origin_docker_repo == 'bitwarden'
|
2021-11-08 19:39:32 +01:00
|
|
|
env:
|
|
|
|
SERVICE_NAME: ${{ steps.setup.outputs.service_name }}
|
2021-10-22 17:41:38 +02:00
|
|
|
run: |
|
2022-02-24 14:55:43 +01:00
|
|
|
if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then
|
|
|
|
docker tag bitwarden/$SERVICE_NAME:latest bitwarden/$SERVICE_NAME:dryrun
|
|
|
|
else
|
|
|
|
docker tag bitwarden/$SERVICE_NAME:$_BRANCH_NAME bitwarden/$SERVICE_NAME:$_RELEASE_VERSION
|
|
|
|
fi
|
2021-10-22 17:41:38 +02:00
|
|
|
|
2021-11-08 19:39:32 +01:00
|
|
|
- name: Push version and latest image
|
2022-09-15 17:21:00 +02:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' && matrix.origin_docker_repo == 'bitwarden' }}
|
2021-10-22 17:41:38 +02:00
|
|
|
env:
|
2022-07-21 16:36:40 +02:00
|
|
|
DOCKER_CONTENT_TRUST: ${{ steps.check-matrix-dct.outputs.dct_enabled }}
|
2021-10-22 17:41:38 +02:00
|
|
|
DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ steps.setup-dct.outputs.dct-delegate-repo-passphrase }}
|
2021-11-08 19:39:32 +01:00
|
|
|
SERVICE_NAME: ${{ steps.setup.outputs.service_name }}
|
2022-11-08 21:26:47 +01:00
|
|
|
run: docker push bitwarden/$SERVICE_NAME:$_RELEASE_VERSION
|
2021-10-22 17:41:38 +02:00
|
|
|
|
2022-03-03 20:00:49 +01:00
|
|
|
- name: Log out of Docker and disable Docker Notary
|
2022-09-15 17:21:00 +02:00
|
|
|
if: matrix.origin_docker_repo == 'bitwarden'
|
2022-03-03 20:00:49 +01:00
|
|
|
run: |
|
|
|
|
docker logout
|
|
|
|
echo "DOCKER_CONTENT_TRUST=0" >> $GITHUB_ENV
|
|
|
|
|
2022-08-25 10:02:24 +02:00
|
|
|
########## ACR QA ##########
|
2022-03-03 20:00:49 +01:00
|
|
|
- name: Login to Azure - QA Subscription
|
|
|
|
uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a
|
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_QA_KV_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Login to Azure ACR
|
|
|
|
run: az acr login -n bitwardenqa
|
|
|
|
|
2022-09-15 17:21:00 +02:00
|
|
|
- name: Pull latest selfhost image
|
|
|
|
if: matrix.origin_docker_repo == 'bitwardenqa.azurecr.io'
|
|
|
|
env:
|
|
|
|
SERVICE_NAME: ${{ steps.setup.outputs.service_name }}
|
|
|
|
REGISTRY: bitwardenqa.azurecr.io
|
|
|
|
run: |
|
|
|
|
if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then
|
|
|
|
docker pull $REGISTRY/$SERVICE_NAME:latest
|
|
|
|
else
|
|
|
|
docker pull $REGISTRY/$SERVICE_NAME:$_BRANCH_NAME
|
|
|
|
fi
|
|
|
|
|
2022-03-03 20:00:49 +01:00
|
|
|
- name: Tag version and latest
|
|
|
|
env:
|
|
|
|
SERVICE_NAME: ${{ steps.setup.outputs.service_name }}
|
|
|
|
REGISTRY: bitwardenqa.azurecr.io
|
2022-09-15 17:21:00 +02:00
|
|
|
ORIGIN_REGISTY: ${{ matrix.origin_docker_repo }}
|
2022-03-03 20:00:49 +01:00
|
|
|
run: |
|
|
|
|
if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then
|
2022-09-15 17:21:00 +02:00
|
|
|
docker tag $ORIGIN_REGISTY/$SERVICE_NAME:latest $REGISTRY/$SERVICE_NAME:dryrun
|
2022-03-03 20:00:49 +01:00
|
|
|
else
|
2022-09-15 17:21:00 +02:00
|
|
|
docker tag $ORIGIN_REGISTY/$SERVICE_NAME:$_BRANCH_NAME $REGISTRY/$SERVICE_NAME:$_RELEASE_VERSION
|
2022-03-03 20:00:49 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Push version and latest image
|
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
|
|
|
env:
|
|
|
|
SERVICE_NAME: ${{ steps.setup.outputs.service_name }}
|
|
|
|
REGISTRY: bitwardenqa.azurecr.io
|
2022-11-08 21:26:47 +01:00
|
|
|
run: docker push $REGISTRY/$SERVICE_NAME:$_RELEASE_VERSION
|
2022-03-03 20:00:49 +01:00
|
|
|
|
2021-10-22 17:41:38 +02:00
|
|
|
- name: Log out of Docker
|
|
|
|
run: docker logout
|
|
|
|
|
2022-08-25 10:02:24 +02:00
|
|
|
########## ACR PROD ##########
|
|
|
|
- name: Login to Azure - PROD Subscription
|
|
|
|
if: matrix.prod_acr == true
|
|
|
|
uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a
|
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Login to Azure ACR
|
|
|
|
if: matrix.prod_acr == true
|
|
|
|
run: az acr login -n bitwardenprod
|
|
|
|
|
|
|
|
- name: Tag version and latest
|
|
|
|
if: matrix.prod_acr == true
|
|
|
|
env:
|
|
|
|
SERVICE_NAME: ${{ steps.setup.outputs.service_name }}
|
|
|
|
REGISTRY: bitwardenprod.azurecr.io
|
2022-09-15 17:21:00 +02:00
|
|
|
ORIGIN_REGISTY: ${{ matrix.origin_docker_repo }}
|
2022-08-25 10:02:24 +02:00
|
|
|
run: |
|
|
|
|
if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then
|
2022-09-15 17:21:00 +02:00
|
|
|
docker tag $ORIGIN_REGISTY/$SERVICE_NAME:latest $REGISTRY/$SERVICE_NAME:dryrun
|
2022-08-25 10:02:24 +02:00
|
|
|
else
|
2022-09-15 17:21:00 +02:00
|
|
|
docker tag $ORIGIN_REGISTY/$SERVICE_NAME:$_BRANCH_NAME $REGISTRY/$SERVICE_NAME:$_RELEASE_VERSION
|
2022-08-25 10:02:24 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Push version and latest image
|
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' && matrix.prod_acr == true }}
|
|
|
|
env:
|
|
|
|
SERVICE_NAME: ${{ steps.setup.outputs.service_name }}
|
|
|
|
REGISTRY: bitwardenprod.azurecr.io
|
2022-11-08 21:26:47 +01:00
|
|
|
run: docker push $REGISTRY/$SERVICE_NAME:$_RELEASE_VERSION
|
2022-08-25 10:02:24 +02:00
|
|
|
|
|
|
|
- name: Log out of Docker
|
|
|
|
if: matrix.prod_acr == true
|
|
|
|
run: docker logout
|
|
|
|
|
2021-10-22 17:41:38 +02:00
|
|
|
|
2021-09-25 00:04:14 +02:00
|
|
|
release:
|
|
|
|
name: Create GitHub Release
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- deploy
|
|
|
|
steps:
|
2021-10-22 17:41:38 +02:00
|
|
|
- name: Download latest Release docker-stub
|
2022-07-19 21:00:57 +02:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
2022-09-28 14:50:43 +02:00
|
|
|
uses: bitwarden/gh-actions/download-artifacts@850faad0cf6c02a8c0dc46eddde2363fbd6c373a
|
2021-09-25 00:04:14 +02:00
|
|
|
with:
|
|
|
|
workflow: build.yml
|
|
|
|
workflow_conclusion: success
|
2021-11-08 19:39:32 +01:00
|
|
|
branch: ${{ needs.setup.outputs.branch-name }}
|
2021-09-25 00:04:14 +02:00
|
|
|
artifacts: "docker-stub.zip,
|
2022-02-28 15:38:59 +01:00
|
|
|
docker-stub-sha256.txt,
|
2021-09-25 00:04:14 +02:00
|
|
|
swagger.json"
|
2022-07-20 18:47:19 +02:00
|
|
|
|
2022-07-19 21:00:57 +02:00
|
|
|
- name: Download latest Release docker-stub
|
|
|
|
if: ${{ github.event.inputs.release_type == 'Dry Run' }}
|
2022-09-28 14:50:43 +02:00
|
|
|
uses: bitwarden/gh-actions/download-artifacts@850faad0cf6c02a8c0dc46eddde2363fbd6c373a
|
2022-07-19 21:00:57 +02:00
|
|
|
with:
|
|
|
|
workflow: build.yml
|
|
|
|
workflow_conclusion: success
|
|
|
|
branch: master
|
|
|
|
artifacts: "docker-stub.zip,
|
|
|
|
docker-stub-sha256.txt,
|
|
|
|
swagger.json"
|
2021-09-25 00:04:14 +02:00
|
|
|
|
|
|
|
- name: Create release
|
2022-02-24 14:55:43 +01:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
|
|
|
uses: ncipollo/release-action@40bb172bd05f266cf9ba4ff965cb61e9ee5f6d01
|
2021-09-25 00:04:14 +02:00
|
|
|
with:
|
|
|
|
artifacts: 'docker-stub.zip,
|
2022-02-28 15:38:59 +01:00
|
|
|
docker-stub-sha256.txt,
|
2021-09-25 00:04:14 +02:00
|
|
|
swagger.json'
|
|
|
|
commit: ${{ github.sha }}
|
2021-09-28 00:30:20 +02:00
|
|
|
tag: "v${{ needs.setup.outputs.release_version }}"
|
2021-09-25 00:04:14 +02:00
|
|
|
name: "Version ${{ needs.setup.outputs.release_version }}"
|
|
|
|
body: "<insert release notes here>"
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
draft: true
|