Skip to content

Commit 27b0e13

Browse files
authored
Merge pull request #63 from cortex-command-community/get-version-from-committed-files
feat: make the master release script pull game version from committed files
2 parents e9c827b + 6412e8d commit 27b0e13

File tree

2 files changed

+30
-25
lines changed

2 files changed

+30
-25
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: 'Get Game version Version'
2+
description: 'Fetches the current game version from the source code'
3+
4+
inputs:
5+
version-file:
6+
description: 'The file containing the version string'
7+
required: false
8+
default: Source/System/GameVersion.h
9+
10+
outputs:
11+
game-version:
12+
description: 'The current version string'
13+
value: ${{ steps.read-version.outputs.game-version }}
14+
15+
runs:
16+
using: "composite"
17+
steps:
18+
- name: Get the current Game Version from the source code
19+
id: read-version
20+
run: echo "game-version=$(grep 'c_VersionString = ' ${{ inputs.version-file }} | awk -F'"' '{print $2}')" >> $GITHUB_OUTPUT
21+
shell: bash

.github/workflows/release.yaml

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ name: Master Build and Release
22
# Controls when the action will run.
33
on:
44
workflow_dispatch:
5-
inputs:
6-
new_release_version:
7-
description: "New version number to release"
8-
type: string
9-
required: true
105

116
concurrency:
127
group: release-${{ github.ref_name }}
@@ -22,15 +17,13 @@ jobs:
2217
uses: ./.github/workflows/meson.yml
2318
with:
2419
upload_artefacts: true
25-
new_release_version: ${{ github.event.inputs.new_release_version }}
2620

2721
build-msbuild-releases:
2822
name: Windows Release Build
2923

3024
uses: ./.github/workflows/msbuild.yml
3125
with:
3226
upload_artefacts: true
33-
new_release_version: ${{ github.event.inputs.new_release_version }}
3427

3528
release:
3629
name: Publish Release
@@ -45,38 +38,30 @@ jobs:
4538
- name: fetch tags
4639
run: git fetch --tags origin
4740

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}}
41+
- name: Get Release Version
42+
id: get-release-version
43+
uses: ./.github/actions/get-game-version
5344

5445
- name: Bundle release assets
5546
uses: ./.github/actions/bundle_release
5647

5748
- name: Create a new Release
5849
run: |
59-
gh release create v${{ github.event.inputs.new_release_version }} \
60-
--title "Release ${{ github.event.inputs.new_release_version }}" \
50+
gh release create v${{ steps.get-release-version.outputs.game-version }} \
51+
--title "Release v${{ steps.get-release-version.outputs.game-version }}" \
6152
--generate-notes \
6253
--draft \
6354
--target ${{ github.ref_name }} \
6455
${{format('--notes-start-tag {0}', env.LATEST_TAG) || ''}} \
65-
'CortexCommand.windows.zip#Cortex Command [v${{ github.event.inputs.new_release_version }}] (Windows Release)' \
66-
'CortexCommand.linux.zip#Cortex Command [v${{ github.event.inputs.new_release_version }}] (Linux Release)' \
67-
'CortexCommand.macos.zip#Cortex Command [v${{ github.event.inputs.new_release_version }}] (macOS Release)'
56+
'CortexCommand.windows.zip#Cortex Command [v${{ steps.get-release-version.outputs.game-version }}] (Windows Release)' \
57+
'CortexCommand.linux.zip#Cortex Command [v${{ steps.get-release-version.outputs.game-version }}] (Linux Release)' \
58+
'CortexCommand.macos.zip#Cortex Command [v${{ steps.get-release-version.outputs.game-version }}] (macOS Release)'
6859
env:
6960
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7061

7162
- name: Commit and push Version Changes and Update latest tag
7263
shell: bash
7364
run: |
74-
git config --global user.email "[email protected]"
75-
git config --global user.name "GitHub Action"
76-
git add Source/System/GameVersion.h meson.build
77-
git commit -m "Release v${{ inputs.new_release_version }}" || echo "No changes to commit"
78-
git push
79-
8065
RELEASE_COMMIT=$(git rev-parse HEAD)
8166
curl -X PATCH \
8267
-H "Authorization: Bearer ${{ secrets.WORKFLOW_TOKEN }}" \
@@ -86,5 +71,4 @@ jobs:
8671
"sha": "'"$RELEASE_COMMIT"'",
8772
"ref": "${{ github.ref }}"
8873
}'
89-
env:
90-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
74+

0 commit comments

Comments
 (0)