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:
|
2022-11-18 20:39:01 +01:00
|
|
|
description: "Release Options"
|
2021-12-20 21:19:18 +01:00
|
|
|
required: true
|
2022-11-18 20:39:01 +01:00
|
|
|
default: "Initial Release"
|
2021-12-20 21:19:18 +01:00
|
|
|
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
|
2022-11-18 20:39:01 +01:00
|
|
|
runs-on: ubuntu-22.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
|
2023-07-03 18:36:42 +02:00
|
|
|
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
2021-05-04 22:41:49 +02:00
|
|
|
|
2021-09-25 00:04:14 +02:00
|
|
|
- name: Check Release Version
|
|
|
|
id: version
|
2023-06-29 23:39:50 +02:00
|
|
|
uses: bitwarden/gh-actions/release-version-check@74f4ac01c9abe0a7331c9a5de822a558fd4a4710
|
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 }})
|
2022-12-05 17:12:42 +01:00
|
|
|
echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT
|
2021-11-08 19:39:32 +01:00
|
|
|
|
2021-09-25 00:04:14 +02:00
|
|
|
deploy:
|
|
|
|
name: Deploy
|
2022-11-18 20:39:01 +01:00
|
|
|
runs-on: ubuntu-22.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"
|
2022-12-05 17:12:42 +01:00
|
|
|
echo "name_lower=$NAME_LOWER" >> $GITHUB_OUTPUT
|
2021-05-04 22:41:49 +02:00
|
|
|
|
2022-07-25 23:19:56 +02:00
|
|
|
- name: Create GitHub deployment for ${{ matrix.name }}
|
2022-11-14 19:43:08 +01:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
2023-05-03 16:20:12 +02:00
|
|
|
uses: chrnorm/deployment-action@d42cde7132fcec920de534fffc3be83794335c00 # v2.0.5
|
2022-07-25 23:19:56 +02:00
|
|
|
id: deployment
|
|
|
|
with:
|
2022-11-18 20:39:01 +01:00
|
|
|
token: "${{ secrets.GITHUB_TOKEN }}"
|
|
|
|
initial-status: "in_progress"
|
|
|
|
environment: "Production Cloud"
|
|
|
|
task: "deploy"
|
|
|
|
description: "Deploy from ${{ needs.setup.outputs.branch-name }} branch"
|
2022-07-25 23:19:56 +02:00
|
|
|
|
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' }}
|
2023-06-29 23:39:50 +02:00
|
|
|
uses: bitwarden/gh-actions/download-artifacts@74f4ac01c9abe0a7331c9a5de822a558fd4a4710
|
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' }}
|
2023-06-29 23:39:50 +02:00
|
|
|
uses: bitwarden/gh-actions/download-artifacts@74f4ac01c9abe0a7331c9a5de822a558fd4a4710
|
2022-07-19 21:00:57 +02:00
|
|
|
with:
|
|
|
|
workflow: build.yml
|
|
|
|
workflow_conclusion: success
|
|
|
|
branch: master
|
|
|
|
artifacts: ${{ matrix.name }}.zip
|
|
|
|
|
2023-04-17 19:03:32 +02:00
|
|
|
- name: Login to Azure - CI subscription
|
2023-07-03 18:36:42 +02:00
|
|
|
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7
|
2023-04-17 19:03:32 +02:00
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
|
|
|
|
2021-09-25 00:04:14 +02:00
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2021-05-04 22:41:49 +02:00
|
|
|
env:
|
2023-04-17 15:06:57 +02:00
|
|
|
VAULT_NAME: "bitwarden-ci"
|
2021-09-25 00:04:14 +02:00
|
|
|
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"
|
2022-12-05 17:12:42 +01:00
|
|
|
echo "webapp-name=$webapp_name" >> $GITHUB_OUTPUT
|
2021-10-27 17:45:33 +02:00
|
|
|
echo "::add-mask::$publish_profile"
|
2022-12-05 17:12:42 +01:00
|
|
|
echo "publish-profile=$publish_profile" >> $GITHUB_OUTPUT
|
2021-05-04 22:41:49 +02:00
|
|
|
|
2023-04-25 20:27:03 +02:00
|
|
|
- name: Login to Azure
|
2023-07-03 18:36:42 +02:00
|
|
|
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7
|
2023-04-25 20:27:03 +02:00
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
|
|
|
|
2021-09-25 00:04:14 +02:00
|
|
|
- name: Deploy App
|
2023-07-13 23:53:13 +02:00
|
|
|
uses: azure/webapps-deploy@85270a1854658d167ab239bce43949edb336fa7c # v2.2.9
|
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-11-14 19:43:08 +01:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' && success() }}
|
2023-05-03 16:20:12 +02:00
|
|
|
uses: chrnorm/deployment-status@2afb7d27101260f4a764219439564d954d10b5b0 # v2.0.1
|
2022-07-25 23:19:56 +02:00
|
|
|
with:
|
2022-11-18 20:39:01 +01:00
|
|
|
token: "${{ secrets.GITHUB_TOKEN }}"
|
|
|
|
state: "success"
|
2022-07-25 23:19:56 +02:00
|
|
|
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
|
|
|
|
|
|
|
|
- name: Update ${{ matrix.name }} deployment status to Failure
|
2022-11-14 19:43:08 +01:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' && failure() }}
|
2023-05-03 16:20:12 +02:00
|
|
|
uses: chrnorm/deployment-status@2afb7d27101260f4a764219439564d954d10b5b0 # v2.0.1
|
2022-07-25 23:19:56 +02:00
|
|
|
with:
|
2022-11-18 20:39:01 +01:00
|
|
|
token: "${{ secrets.GITHUB_TOKEN }}"
|
|
|
|
state: "failure"
|
2022-07-25 23:19:56 +02:00
|
|
|
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
|
|
|
|
|
2021-10-22 17:41:38 +02:00
|
|
|
release-docker:
|
|
|
|
name: Build Docker images
|
2022-11-18 20:39:01 +01:00
|
|
|
runs-on: ubuntu-22.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:
|
2022-11-18 20:39:01 +01:00
|
|
|
- project_name: Admin
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2022-11-18 20:39:01 +01:00
|
|
|
- project_name: Api
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2022-11-18 20:39:01 +01:00
|
|
|
- project_name: Attachments
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2022-11-18 20:39:01 +01:00
|
|
|
- project_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
|
2022-11-18 20:39:01 +01:00
|
|
|
- project_name: EventsProcessor
|
2022-09-15 17:21:00 +02:00
|
|
|
prod_acr: true
|
2023-02-15 11:45:46 +01:00
|
|
|
origin_docker_repo: bitwardenprod.azurecr.io
|
2022-11-18 20:39:01 +01:00
|
|
|
- project_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
|
2022-11-18 20:39:01 +01:00
|
|
|
- project_name: Identity
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2022-11-18 20:39:01 +01:00
|
|
|
- project_name: MsSql
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2022-11-18 20:39:01 +01:00
|
|
|
- project_name: Nginx
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2022-11-18 20:39:01 +01:00
|
|
|
- project_name: Notifications
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2022-11-18 20:39:01 +01:00
|
|
|
- project_name: Server
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2022-11-18 20:39:01 +01:00
|
|
|
- project_name: Setup
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2022-11-18 20:39:01 +01:00
|
|
|
- project_name: Sso
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2022-11-18 20:39:01 +01:00
|
|
|
- project_name: Scim
|
2022-09-15 17:21:00 +02:00
|
|
|
origin_docker_repo: bitwarden
|
2022-12-20 12:09:17 +01:00
|
|
|
- project_name: Billing
|
2023-02-15 11:45:46 +01:00
|
|
|
origin_docker_repo: bitwardenprod.azurecr.io
|
2023-06-14 16:12:36 +02:00
|
|
|
- project_name: MsSqlMigratorUtility
|
|
|
|
origin_docker_repo: bitwardenprod.azurecr.io
|
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
|
2023-07-03 18:36:42 +02:00
|
|
|
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
2021-10-22 17:41:38 +02:00
|
|
|
|
2022-11-18 20:39:01 +01:00
|
|
|
- name: Setup project name
|
2021-10-22 17:41:38 +02:00
|
|
|
id: setup
|
|
|
|
run: |
|
2022-11-18 20:39:01 +01:00
|
|
|
PROJECT_NAME=$(echo "${{ matrix.project_name }}" | awk '{print tolower($0)}')
|
|
|
|
echo "Matrix name: ${{ matrix.project_name }}"
|
|
|
|
echo "PROJECT_NAME: $PROJECT_NAME"
|
2022-12-05 17:12:42 +01:00
|
|
|
echo "project_name=$PROJECT_NAME" >> $GITHUB_OUTPUT
|
2021-10-22 17:41:38 +02:00
|
|
|
|
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'
|
2023-06-29 23:39:50 +02:00
|
|
|
uses: bitwarden/gh-actions/setup-docker-trust@74f4ac01c9abe0a7331c9a5de822a558fd4a4710
|
2022-03-03 20:00:49 +01:00
|
|
|
with:
|
2023-04-17 19:03:32 +02:00
|
|
|
azure-creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
2023-04-17 15:06:57 +02:00
|
|
|
azure-keyvault-name: "bitwarden-ci"
|
2022-03-03 20:00:49 +01:00
|
|
|
|
2022-11-18 20:39:01 +01:00
|
|
|
- name: Pull latest project image
|
2022-09-15 17:21:00 +02:00
|
|
|
if: matrix.origin_docker_repo == 'bitwarden'
|
2021-11-08 19:39:32 +01:00
|
|
|
env:
|
2022-11-18 20:39:01 +01:00
|
|
|
PROJECT_NAME: ${{ steps.setup.outputs.project_name }}
|
2022-02-24 14:55:43 +01:00
|
|
|
run: |
|
|
|
|
if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then
|
2022-11-18 20:39:01 +01:00
|
|
|
docker pull bitwarden/$PROJECT_NAME:latest
|
2022-02-24 14:55:43 +01:00
|
|
|
else
|
2022-11-18 20:39:01 +01:00
|
|
|
docker pull bitwarden/$PROJECT_NAME:$_BRANCH_NAME
|
2022-02-24 14:55:43 +01:00
|
|
|
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:
|
2022-11-18 20:39:01 +01:00
|
|
|
PROJECT_NAME: ${{ steps.setup.outputs.project_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
|
2022-11-18 20:39:01 +01:00
|
|
|
docker tag bitwarden/$PROJECT_NAME:latest bitwarden/$PROJECT_NAME:dryrun
|
2022-02-24 14:55:43 +01:00
|
|
|
else
|
2022-11-18 20:39:01 +01:00
|
|
|
docker tag bitwarden/$PROJECT_NAME:$_BRANCH_NAME bitwarden/$PROJECT_NAME:$_RELEASE_VERSION
|
2022-02-24 14:55:43 +01:00
|
|
|
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-12-06 15:48:55 +01:00
|
|
|
DOCKER_CONTENT_TRUST: 1
|
2021-10-22 17:41:38 +02:00
|
|
|
DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ steps.setup-dct.outputs.dct-delegate-repo-passphrase }}
|
2022-11-18 20:39:01 +01:00
|
|
|
PROJECT_NAME: ${{ steps.setup.outputs.project_name }}
|
|
|
|
run: docker push bitwarden/$PROJECT_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 PROD ##########
|
|
|
|
- name: Login to Azure - PROD Subscription
|
2023-07-03 18:36:42 +02:00
|
|
|
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7
|
2022-08-25 10:02:24 +02:00
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Login to Azure ACR
|
|
|
|
run: az acr login -n bitwardenprod
|
|
|
|
|
2023-05-01 21:56:04 +02:00
|
|
|
- name: Pull latest project image
|
|
|
|
if: matrix.origin_docker_repo == 'bitwardenprod.azurecr.io'
|
|
|
|
env:
|
|
|
|
PROJECT_NAME: ${{ steps.setup.outputs.project_name }}
|
|
|
|
ORIGIN_REGISTRY: ${{ matrix.origin_docker_repo }}
|
|
|
|
run: |
|
|
|
|
if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then
|
|
|
|
docker pull $ORIGIN_REGISTRY/$PROJECT_NAME:dev
|
|
|
|
else
|
|
|
|
docker pull $ORIGIN_REGISTRY/$PROJECT_NAME:$_BRANCH_NAME
|
|
|
|
fi
|
|
|
|
|
2022-08-25 10:02:24 +02:00
|
|
|
- name: Tag version and latest
|
2023-05-01 21:56:04 +02:00
|
|
|
if: matrix.origin_docker_repo == 'bitwardenprod.azurecr.io'
|
2022-08-25 10:02:24 +02:00
|
|
|
env:
|
2022-11-18 20:39:01 +01:00
|
|
|
PROJECT_NAME: ${{ steps.setup.outputs.project_name }}
|
2022-08-25 10:02:24 +02:00
|
|
|
REGISTRY: bitwardenprod.azurecr.io
|
2022-11-18 20:39:01 +01:00
|
|
|
ORIGIN_REGISTRY: ${{ matrix.origin_docker_repo }}
|
2022-08-25 10:02:24 +02:00
|
|
|
run: |
|
|
|
|
if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then
|
2023-05-01 21:56:04 +02:00
|
|
|
docker tag $ORIGIN_REGISTRY/$PROJECT_NAME:dev $REGISTRY/$PROJECT_NAME:dryrun
|
2022-08-25 10:02:24 +02:00
|
|
|
else
|
2022-11-18 20:39:01 +01:00
|
|
|
docker tag $ORIGIN_REGISTRY/$PROJECT_NAME:$_BRANCH_NAME $REGISTRY/$PROJECT_NAME:$_RELEASE_VERSION
|
|
|
|
docker tag $ORIGIN_REGISTRY/$PROJECT_NAME:$_BRANCH_NAME $REGISTRY/$PROJECT_NAME:latest
|
2022-08-25 10:02:24 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Push version and latest image
|
2023-05-31 02:31:14 +02:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' && matrix.origin_docker_repo == 'bitwardenprod.azurecr.io' }}
|
2022-08-25 10:02:24 +02:00
|
|
|
env:
|
2022-11-18 20:39:01 +01:00
|
|
|
PROJECT_NAME: ${{ steps.setup.outputs.project_name }}
|
2022-08-25 10:02:24 +02:00
|
|
|
REGISTRY: bitwardenprod.azurecr.io
|
2022-11-18 20:39:01 +01:00
|
|
|
run: |
|
|
|
|
docker push $REGISTRY/$PROJECT_NAME:$_RELEASE_VERSION
|
|
|
|
docker push $REGISTRY/$PROJECT_NAME:latest
|
2022-08-25 10:02:24 +02:00
|
|
|
|
|
|
|
- name: Log out of Docker
|
|
|
|
run: docker logout
|
|
|
|
|
2021-09-25 00:04:14 +02:00
|
|
|
release:
|
|
|
|
name: Create GitHub Release
|
2022-11-18 20:39:01 +01:00
|
|
|
runs-on: ubuntu-22.04
|
2021-09-25 00:04:14 +02:00
|
|
|
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' }}
|
2023-06-29 23:39:50 +02:00
|
|
|
uses: bitwarden/gh-actions/download-artifacts@74f4ac01c9abe0a7331c9a5de822a558fd4a4710
|
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-11-18 20:39:01 +01:00
|
|
|
docker-stub-sha256.txt,
|
|
|
|
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' }}
|
2023-06-29 23:39:50 +02:00
|
|
|
uses: bitwarden/gh-actions/download-artifacts@74f4ac01c9abe0a7331c9a5de822a558fd4a4710
|
2022-07-19 21:00:57 +02:00
|
|
|
with:
|
|
|
|
workflow: build.yml
|
|
|
|
workflow_conclusion: success
|
|
|
|
branch: master
|
|
|
|
artifacts: "docker-stub.zip,
|
2022-11-18 20:39:01 +01:00
|
|
|
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' }}
|
2023-05-03 16:20:12 +02:00
|
|
|
uses: ncipollo/release-action@a2e71bdd4e7dab70ca26a852f29600c98b33153e # v1.12.0
|
2021-09-25 00:04:14 +02:00
|
|
|
with:
|
2022-11-18 20:39:01 +01:00
|
|
|
artifacts: "docker-stub.zip,
|
|
|
|
docker-stub-sha256.txt,
|
|
|
|
swagger.json"
|
2021-09-25 00:04:14 +02:00
|
|
|
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
|