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
|
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 }})
|
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' }}
|
2022-07-25 23:19:56 +02:00
|
|
|
uses: chrnorm/deployment-action@1b599fe41a0ef1f95191e7f2eec4743f2d7dfc48
|
|
|
|
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' }}
|
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
|
|
|
|
2023-04-17 19:03:32 +02:00
|
|
|
- name: Login to Azure - CI subscription
|
|
|
|
uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf
|
|
|
|
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
|
|
|
|
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-11-14 19:43:08 +01:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' && success() }}
|
2022-07-25 23:19:56 +02:00
|
|
|
uses: chrnorm/deployment-status@07b3930847f65e71c9c6802ff5a402f6dfb46b86
|
|
|
|
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() }}
|
2022-07-25 23:19:56 +02:00
|
|
|
uses: chrnorm/deployment-status@07b3930847f65e71c9c6802ff5a402f6dfb46b86
|
|
|
|
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
|
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
|
|
|
|
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'
|
2022-03-03 20:00:49 +01:00
|
|
|
uses: bitwarden/gh-actions/setup-docker-trust@a8c384a05a974c05c48374c818b004be221d43ff
|
|
|
|
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
|
|
|
|
uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a
|
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Login to Azure ACR
|
|
|
|
run: az acr login -n bitwardenprod
|
|
|
|
|
|
|
|
- name: Tag version and latest
|
|
|
|
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
|
2022-11-18 20:39:01 +01:00
|
|
|
docker tag $ORIGIN_REGISTRY/$PROJECT_NAME:latest $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-02-15 11:45:46 +01:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
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' }}
|
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-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' }}
|
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,
|
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' }}
|
|
|
|
uses: ncipollo/release-action@40bb172bd05f266cf9ba4ff965cb61e9ee5f6d01
|
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
|