Skip to content

Commit 46d64bb

Browse files
committed
add a new release workflow to publish releases
1 parent a5eca2f commit 46d64bb

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

.github/workflows/release.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Build and Release
2+
# Controls when the action will run.
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
new_release_version:
7+
description: "New version number to release"
8+
type: string
9+
required: true
10+
11+
concurrency:
12+
group: release-${{ github.ref_name }}
13+
14+
env:
15+
LATEST_TAG: latest
16+
17+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
18+
jobs:
19+
build-meson-releases:
20+
name: Linux & macOS Release Builds
21+
22+
uses: ./.github/workflows/meson.yml
23+
with:
24+
upload_artefacts: true
25+
new_release_version: ${{ github.event.inputs.new_release_version }}
26+
27+
build-msbuild-releases:
28+
name: Windows Release Build
29+
30+
uses: ./.github/workflows/msbuild.yml
31+
with:
32+
upload_artefacts: true
33+
new_release_version: ${{ github.event.inputs.new_release_version }}
34+
35+
release:
36+
name: Publish Release
37+
runs-on: ubuntu-latest
38+
39+
needs: [build-msbuild-releases, build-meson-releases]
40+
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v3
44+
45+
- name: fetch tags
46+
run: git fetch --tags origin
47+
48+
- name: Set Version
49+
if: ${{ github.event.inputs.new_release_version}}
50+
uses: ./.github/actions/set_version
51+
with:
52+
new_release_version: ${{ github.event.inputs.new_release_version}}
53+
commit_changes: true
54+
55+
- name: Bundle release assets
56+
uses: ./.github/actions/bundle_release
57+
58+
- name: Create a new Release
59+
run: |
60+
gh release create ${{ github.event.inputs.new_release_version }} \
61+
--title "Release ${{ github.event.inputs.new_release_version }}" \
62+
--generate-notes \
63+
--draft \
64+
${{format('--notes-start-tag {0}', env.LATEST_TAG) || ''}} \
65+
--prerelease \
66+
'CortexCommand.windows.zip#Cortex Command [${{ github.event.inputs.new_release_version }}] (Windows Release)' \
67+
'CortexCommand.linux.zip#Cortex Command [${{ github.event.inputs.new_release_version }}] (Linux Release)' \
68+
'CortexCommand.macos.zip#Cortex Command [${{ github.event.inputs.new_release_version }}] (macOS Release)'
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
72+
- name: Update latest tag
73+
run: |
74+
curl -X POST \
75+
-H "Authorization: Bearer ${{ secrets.WORKFLOW_TOKEN }}" \
76+
-H "Accept: application/vnd.github.v3+json" \
77+
https://api.github.com/repos/${{ github.repository }}/git/refs \
78+
-d '{
79+
"ref": "refs/tags/${{ env.LATEST_TAG }}",
80+
"sha": "${{ github.sha }}"
81+
}'

0 commit comments

Comments
 (0)