-
Notifications
You must be signed in to change notification settings - Fork 6
119 lines (109 loc) · 3.82 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
---
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 }}