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
|
|
|
|
2023-08-14 16:56:54 +02:00
|
|
|
env:
|
2024-01-23 19:24:52 +01:00
|
|
|
_AZ_REGISTRY: "bitwardenprod.azurecr.io"
|
2023-08-14 16:56:54 +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
|
2024-07-09 15:24:25 +02:00
|
|
|
if: ${{ 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
|
|
|
|
|
2024-01-23 19:24:52 +01:00
|
|
|
- name: Check out repo
|
2024-10-17 16:42:44 +02:00
|
|
|
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
|
2021-05-04 22:41:49 +02:00
|
|
|
|
2024-01-23 19:24:52 +01:00
|
|
|
- name: Check release version
|
2021-09-25 00:04:14 +02:00
|
|
|
id: version
|
2023-11-08 19:08:15 +01:00
|
|
|
uses: bitwarden/gh-actions/release-version-check@main
|
2022-06-01 01:11:21 +02:00
|
|
|
with:
|
2024-07-09 15:24:25 +02:00
|
|
|
release-type: ${{ 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
|
|
|
release:
|
2024-01-23 19:24:52 +01:00
|
|
|
name: Create GitHub release
|
2022-11-18 20:39:01 +01:00
|
|
|
runs-on: ubuntu-22.04
|
2024-08-08 15:42:58 +02:00
|
|
|
needs: setup
|
2021-09-25 00:04:14 +02:00
|
|
|
steps:
|
2024-01-23 19:24:52 +01:00
|
|
|
- name: Download latest release Docker stubs
|
2024-07-09 15:24:25 +02:00
|
|
|
if: ${{ inputs.release_type != 'Dry Run' }}
|
2023-11-08 19:08:15 +01:00
|
|
|
uses: bitwarden/gh-actions/download-artifacts@main
|
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 }}
|
2023-07-31 19:14:33 +02:00
|
|
|
artifacts: "docker-stub-US.zip,
|
|
|
|
docker-stub-US-sha256.txt,
|
|
|
|
docker-stub-EU.zip,
|
|
|
|
docker-stub-EU-sha256.txt,
|
2022-11-18 20:39:01 +01:00
|
|
|
swagger.json"
|
2022-07-20 18:47:19 +02:00
|
|
|
|
2024-01-23 19:24:52 +01:00
|
|
|
- name: Dry Run - Download latest release Docker stubs
|
2024-07-09 15:24:25 +02:00
|
|
|
if: ${{ inputs.release_type == 'Dry Run' }}
|
2023-11-08 19:08:15 +01:00
|
|
|
uses: bitwarden/gh-actions/download-artifacts@main
|
2022-07-19 21:00:57 +02:00
|
|
|
with:
|
|
|
|
workflow: build.yml
|
|
|
|
workflow_conclusion: success
|
2023-12-12 21:08:12 +01:00
|
|
|
branch: main
|
2023-07-31 19:14:33 +02:00
|
|
|
artifacts: "docker-stub-US.zip,
|
|
|
|
docker-stub-US-sha256.txt,
|
|
|
|
docker-stub-EU.zip,
|
|
|
|
docker-stub-EU-sha256.txt,
|
2022-11-18 20:39:01 +01:00
|
|
|
swagger.json"
|
2021-09-25 00:04:14 +02:00
|
|
|
|
|
|
|
- name: Create release
|
2024-07-09 15:24:25 +02:00
|
|
|
if: ${{ inputs.release_type != 'Dry Run' }}
|
2024-07-10 21:47:20 +02:00
|
|
|
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
|
2021-09-25 00:04:14 +02:00
|
|
|
with:
|
2023-07-31 19:14:33 +02:00
|
|
|
artifacts: "docker-stub-US.zip,
|
|
|
|
docker-stub-US-sha256.txt,
|
|
|
|
docker-stub-EU.zip,
|
|
|
|
docker-stub-EU-sha256.txt,
|
2022-11-18 20:39:01 +01:00
|
|
|
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
|