You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
3.0 KiB
99 lines
3.0 KiB
name: Release |
|
run-name: Release ${{ inputs.release_type }} |
|
|
|
on: |
|
workflow_dispatch: |
|
inputs: |
|
release_type: |
|
description: "Release Options" |
|
required: true |
|
default: "Initial Release" |
|
type: choice |
|
options: |
|
- Initial Release |
|
- Redeploy |
|
- Dry Run |
|
|
|
env: |
|
_AZ_REGISTRY: "bitwardenprod.azurecr.io" |
|
|
|
permissions: |
|
contents: read |
|
|
|
jobs: |
|
setup: |
|
name: Setup |
|
runs-on: ubuntu-22.04 |
|
outputs: |
|
release_version: ${{ steps.version.outputs.version }} |
|
branch-name: ${{ steps.branch.outputs.branch-name }} |
|
steps: |
|
- name: Branch check |
|
if: ${{ inputs.release_type != 'Dry Run' }} |
|
run: | |
|
if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then |
|
echo "===================================" |
|
echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches" |
|
echo "===================================" |
|
exit 1 |
|
fi |
|
|
|
- name: Check out repo |
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
|
|
|
- name: Check release version |
|
id: version |
|
uses: bitwarden/gh-actions/release-version-check@main |
|
with: |
|
release-type: ${{ inputs.release_type }} |
|
project-type: dotnet |
|
file: Directory.Build.props |
|
|
|
- name: Get branch name |
|
id: branch |
|
run: | |
|
BRANCH_NAME=$(basename ${{ github.ref }}) |
|
echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT |
|
|
|
release: |
|
name: Create GitHub release |
|
runs-on: ubuntu-22.04 |
|
needs: setup |
|
permissions: |
|
contents: write |
|
steps: |
|
- name: Download latest release Docker stubs |
|
if: ${{ inputs.release_type != 'Dry Run' }} |
|
uses: bitwarden/gh-actions/download-artifacts@main |
|
with: |
|
workflow: build.yml |
|
workflow_conclusion: success |
|
branch: ${{ needs.setup.outputs.branch-name }} |
|
artifacts: "docker-stub-US.zip, |
|
docker-stub-EU.zip, |
|
swagger.json" |
|
|
|
- name: Dry Run - Download latest release Docker stubs |
|
if: ${{ inputs.release_type == 'Dry Run' }} |
|
uses: bitwarden/gh-actions/download-artifacts@main |
|
with: |
|
workflow: build.yml |
|
workflow_conclusion: success |
|
branch: main |
|
artifacts: "docker-stub-US.zip, |
|
docker-stub-EU.zip, |
|
swagger.json" |
|
|
|
- name: Create release |
|
if: ${{ inputs.release_type != 'Dry Run' }} |
|
uses: ncipollo/release-action@cdcc88a9acf3ca41c16c37bb7d21b9ad48560d87 # v1.15.0 |
|
with: |
|
artifacts: "docker-stub-US.zip, |
|
docker-stub-EU.zip, |
|
swagger.json" |
|
commit: ${{ github.sha }} |
|
tag: "v${{ needs.setup.outputs.release_version }}" |
|
name: "Version ${{ needs.setup.outputs.release_version }}" |
|
body: "<insert release notes here>" |
|
token: ${{ secrets.GITHUB_TOKEN }} |
|
draft: true
|
|
|