Release - Release #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Release | |
run-name: Release - ${{ inputs.release_type }} | |
on: | |
workflow_dispatch: | |
inputs: | |
release_type: | |
description: "Release Options" | |
required: true | |
default: "Release" | |
type: choice | |
options: | |
- Release | |
- Dry Run | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Branch check | |
if: ${{ inputs.release_type != 'Dry Run' }} | |
run: | | |
if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then | |
echo "===================================" | |
echo "[!] Can only release from the 'main' branch" | |
echo "===================================" | |
exit 1 | |
fi | |
- name: Checkout repo | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Check Release Version | |
id: version | |
uses: bitwarden/gh-actions/release-version-check@main | |
with: | |
release-type: ${{ inputs.release_type }} | |
project-type: dotnet | |
file: src/Handlebars.conf/Handlebars.conf.csproj | |
- name: Download all Release artifacts | |
uses: bitwarden/gh-actions/download-artifacts@main | |
with: | |
workflow: build.yml | |
path: artifacts | |
workflow_conclusion: success | |
branch: ${{ github.ref_name }} | |
- name: Create release | |
if: ${{ inputs.release_type != 'Dry Run' }} | |
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 | |
env: | |
PKG_VERSION: ${{ steps.version.outputs.version }} | |
with: | |
artifacts: "artifacts/hbs_linux-arm.zip, | |
artifacts/hbs_linux-arm64.zip, | |
artifacts/hbs_linux-arm64_dotnet.zip, | |
artifacts/hbs_linux-arm_dotnet.zip, | |
artifacts/hbs_linux-musl-arm64.zip, | |
artifacts/hbs_linux-musl-arm64_dotnet.zip, | |
artifacts/hbs_linux-musl-x64.zip, | |
artifacts/hbs_linux-musl-x64_dotnet.zip, | |
artifacts/hbs_linux-x64.zip, | |
artifacts/hbs_linux-x64_dotnet.zip, | |
artifacts/hbs_osx-arm64.zip, | |
artifacts/hbs_osx-arm64_dotnet.zip, | |
artifacts/hbs_osx-x64.zip, | |
artifacts/hbs_osx-x64_dotnet.zip, | |
artifacts/hbs_win-arm64.zip, | |
artifacts/hbs_win-arm64_dotnet.zip, | |
artifacts/hbs_win-x64.zip, | |
artifacts/hbs_win-x64_dotnet.zip, | |
artifacts/hbs_win-x86.zip, | |
artifacts/hbs_win-x86_dotnet.zip" | |
commit: ${{ github.sha }} | |
tag: v${{ env.PKG_VERSION }} | |
name: Version ${{ env.PKG_VERSION }} | |
body: "<insert release notes here>" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
draft: true | |
check-failures: | |
name: Check for failures | |
if: always() | |
runs-on: ubuntu-22.04 | |
needs: release | |
steps: | |
- name: Check if any job failed | |
if: github.ref == 'refs/heads/main' | |
env: | |
RELEASE_STATUS: ${{ needs.release.result }} | |
run: | | |
if [ "$RELEASE_STATUS" = "failure" ]; then | |
exit 1 | |
fi | |
- name: Login to Azure - CI subscription | |
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 | |
if: failure() | |
with: | |
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} | |
- name: Retrieve secrets | |
id: retrieve-secrets | |
uses: bitwarden/gh-actions/get-keyvault-secrets@main | |
if: failure() | |
with: | |
keyvault: "bitwarden-ci" | |
secrets: "devops-alerts-slack-webhook-url" | |
- name: Notify Slack on failure | |
uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f # v2.0.0 | |
if: failure() | |
env: | |
SLACK_WEBHOOK_URL: ${{ steps.retrieve-secrets.outputs.devops-alerts-slack-webhook-url }} | |
with: | |
status: ${{ job.status }} |