-
Notifications
You must be signed in to change notification settings - Fork 386
51 lines (47 loc) · 1.68 KB
/
manual-release.yml
File metadata and controls
51 lines (47 loc) · 1.68 KB
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
name: "Manual release"
run-name: "Manual Release ${{ inputs.major }}.${{ inputs.minor }}.${{ inputs.patch }}"
concurrency: release
on:
workflow_dispatch:
inputs:
major:
{ description: SemVer major, required: true, type: number, default: 0 }
minor: { description: SemVer minor, required: true, type: number }
patch:
{ description: SemVer patch, required: true, type: number, default: 0 }
env:
VERSION: "v${{ inputs.major }}.${{ inputs.minor }}.${{ inputs.patch }}"
jobs:
release:
name: Create Release
runs-on: ubuntu-slim
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Create release
run: |
set +e
gh release view ${{ env.VERSION }} --json name --jq '.name'
HAS_NO_RELEASE=$? # error == exitcode 1 == no release of given version exists
if (( $HAS_NO_RELEASE == 0 )); then
echo "Release already exists, skipping." >> "$GITHUB_STEP_SUMMARY"
else
echo "Release does not exist, creating a new one" >> "$GITHUB_STEP_SUMMARY"
gh release create ${{ env.VERSION }} \
--title "Cataclysm-BN ${{ env.VERSION }}" \
--draft \
--prerelease \
--generate-notes \
--target ${{ github.sha }}
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
builds:
needs: release
uses: ./.github/workflows/build.yml
with:
version-label: "v${{ inputs.major }}.${{ inputs.minor }}.${{ inputs.patch }}"
upload-to-release: true
release-tag: "v${{ inputs.major }}.${{ inputs.minor }}.${{ inputs.patch }}"
secrets: inherit