Skip to content

Commit d1bb123

Browse files
committed
Merge branch 'development' into ModuleMan
2 parents d5e1b7b + 84730fc commit d1bb123

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+830
-147
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: 'Bundle Release Assets'
2+
description: 'Downloads build assets and packages them into a zip file along with game data and libraries'
3+
runs:
4+
using: "composite"
5+
steps:
6+
- run: mkdir release
7+
shell: bash
8+
9+
- name: Download build artefacts
10+
uses: actions/download-artifact@v3
11+
with:
12+
path: release
13+
14+
- run: ls -R release
15+
shell: bash
16+
17+
- name: Compress Windows Release
18+
shell: bash
19+
run: |
20+
zip --must-match -j CortexCommand.windows.zip \
21+
release/Cortex\ Command*.exe/Cortex\ Command*.exe \
22+
external/lib/win/{fmod,SDL2}.dll
23+
24+
- name: Compress Linux Release
25+
shell: bash
26+
run: |
27+
zip --must-match -j CortexCommand.linux.zip \
28+
"release/CortexCommand (Linux)/CortexCommand.AppImage" \
29+
external/lib/linux/x86_64/libfmod.so*
30+
31+
- name: Compress OSX Release
32+
shell: bash
33+
run: |
34+
zip --must-match -j CortexCommand.macos.zip \
35+
"release/CortexCommand (macOS)/CortexCommand.tar" \
36+
external/lib/macos/libfmod.dylib
37+
38+
- name: Package Data files
39+
shell: bash
40+
run: |
41+
zip --must-match -r -u CortexCommand.windows.zip Data
42+
zip --must-match -r -u CortexCommand.linux.zip Data
43+
zip --must-match -r -u CortexCommand.macos.zip Data
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 'Set Version'
2+
description: 'Updates all references to the current game version'
3+
inputs:
4+
new_release_version:
5+
description: 'The new version string'
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Set Constants.h GameVersion
11+
run: sed -i -E '/c_VersionString = /s/"[^"]*"/"${{inputs.new_release_version}}"/' Source/System/GameVersion.h
12+
shell: bash
13+
14+
- uses: actions/setup-python@v3
15+
16+
- name: Rewrite meson version
17+
run: |
18+
pip install meson
19+
meson rewrite kwargs set project // version ${{ inputs.new_release_version }}
20+
shell: bash

.github/workflows/master_build.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/meson.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ on:
2626
- "release"
2727
- "minimal"
2828
- "full"
29+
new_release_version:
30+
type: string
31+
required: false
2932

3033
# Triggers the workflow when called by a top-level workflow
3134
workflow_call:
@@ -42,6 +45,9 @@ on:
4245
type: string
4346
required: false
4447
default: "release"
48+
new_release_version:
49+
type: string
50+
required: false
4551

4652
jobs:
4753
build-linux:
@@ -59,6 +65,13 @@ jobs:
5965
sudo apt-get install --no-install-recommends wget liballegro4-dev libloadpng4-dev libflac++-dev luajit-5.1-dev liblua5.2-dev libminizip-dev liblz4-dev libpng++-dev libx11-dev libboost-dev libtbb-dev libsdl2-dev libsdl2-image-dev libopengl-dev libfuse2 ninja-build
6066
sudo pip install meson
6167
68+
- name: Set Version
69+
if: ${{inputs.new_release_version}}
70+
uses: ./.github/actions/set_version
71+
with:
72+
new_release_version: ${{inputs.new_release_version}}
73+
github_token: ${{ secrets.GITHUB_TOKEN }}
74+
6275
- name: Setup Meson
6376
env:
6477
CC: "gcc"
@@ -114,7 +127,7 @@ jobs:
114127
build-macos:
115128
runs-on: macos-11
116129
name: MacOS Build
117-
130+
118131
env:
119132
GCC_VERSION: "13"
120133
MACOSX_DEPLOYMENT_TARGET: 10.15
@@ -124,8 +137,15 @@ jobs:
124137

125138
- name: "Install Dependencies"
126139
uses: melusina-org/setup-macports@v1
127-
with:
128-
parameters: ".github/parameters/macports.yml"
140+
with:
141+
parameters: ".github/parameters/macports.yml"
142+
143+
- name: Set Version
144+
if: ${{inputs.new_release_version}}
145+
uses: ./.github/actions/set_version
146+
with:
147+
new_release_version: ${{inputs.new_release_version}}
148+
github_token: ${{ secrets.GITHUB_TOKEN }}
129149

130150
- name: Setup Meson
131151
env:

.github/workflows/msbuild.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ on:
1919
- "Debug Release"
2020
- "Debug Minimal"
2121
- "Debug Full"
22+
new_release_version:
23+
type: string
24+
required: false
2225

2326
# Triggers the workflow when called by a top-level workflow
2427
workflow_call:
@@ -31,7 +34,9 @@ on:
3134
type: string
3235
required: false
3336
default: "Final"
34-
37+
new_release_version:
38+
type: string
39+
required: false
3540
env:
3641
# Path to the solution file relative to the root of the project.
3742
SOLUTION_FILE_PATH: RTEA.sln
@@ -54,6 +59,13 @@ jobs:
5459
- name: Add MSBuild to PATH
5560
uses: microsoft/setup-msbuild@v1
5661

62+
- name: Set Version
63+
if: ${{inputs.new_release_version}}
64+
uses: ./.github/actions/set_version
65+
with:
66+
new_release_version: ${{inputs.new_release_version}}
67+
github_token: ${{ secrets.GITHUB_TOKEN }}
68+
5769
- name: Build
5870
working-directory: ${{env.GITHUB_WORKSPACE}}
5971
# Add additional options to the MSBuild command line here (like platform or verbosity level).
@@ -72,5 +84,5 @@ jobs:
7284
uses: actions/upload-artifact@v3
7385
with:
7486
name: ${{ steps.executable_name.outputs.EXECUTABLE_NAME }}
75-
path: D:/a/Cortex-Command-Community-Project/Cortex-Command-Community-Project/${{ steps.executable_name.outputs.EXECUTABLE_NAME }}
87+
path: ${{ steps.executable_name.outputs.EXECUTABLE_NAME }}
7688
if-no-files-found: error

.github/workflows/nightly.yaml

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
name: Nightly (Development) Build and Release
2+
# Controls when the action will run.
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 0 * * *"
7+
8+
concurrency:
9+
group: nightly-${{ github.ref_name }}
10+
# cancel-in-progress: true
11+
12+
env:
13+
PREV_TAG: nightly-prev
14+
15+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
16+
jobs:
17+
check-for-changes:
18+
name: Determine if a new nightly build should be released
19+
runs-on: ubuntu-latest
20+
21+
outputs:
22+
needs_build: ${{ steps.check_manual_run.outputs.needs_build == 'true' || steps.check_tags.outputs.needs_build == 'true' }}
23+
24+
steps:
25+
- name: Check if workflow was manually triggered
26+
id: check_manual_run
27+
run: |
28+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
29+
echo "Workflow dispatched manually. Continuing..."
30+
echo "needs_build=true" >> $GITHUB_OUTPUT;
31+
else
32+
echo "Workflow triggered by a scheduled run. Continuing..."
33+
echo "needs_build=false" >> $GITHUB_OUTPUT;
34+
fi
35+
36+
- name: Checkout code
37+
if: ${{ steps.check_manual_run.outputs.needs_build == 'false' }}
38+
uses: actions/checkout@v3
39+
40+
- name: fetch tags
41+
if: ${{ steps.check_manual_run.outputs.needs_build == 'false' }}
42+
run: git fetch --tags origin
43+
44+
- name: Check if tags point to the same commit or if the workflow was manually triggered
45+
if: ${{ steps.check_manual_run.outputs.needs_build == 'false' }}
46+
id: check_tags
47+
run: |
48+
curr_sha=$(git rev-parse HEAD)
49+
prev_sha=$(git rev-parse ${{ env.PREV_TAG }} 2>/dev/null)
50+
51+
if [[ $? -ne 0 ]]; then
52+
echo "Tag ${{ env.PREV_TAG }} cannot be resolved. Continuing..."
53+
echo "needs_build=true" >> $GITHUB_OUTPUT;
54+
elif [[ "$curr_sha" == "$prev_sha" ]]; then
55+
echo "No changes since last nightly release. Exiting..."
56+
echo "needs_build=false" >> $GITHUB_OUTPUT;
57+
else
58+
echo "Changes since last nightly release detected. Continuing..."
59+
echo "needs_build=true" >> $GITHUB_OUTPUT;
60+
fi
61+
62+
build-meson-releases:
63+
name: Linux & macOS Release Builds
64+
65+
needs: check-for-changes
66+
if: needs.check-for-changes.outputs.needs_build == 'true'
67+
68+
uses: ./.github/workflows/meson.yml
69+
with:
70+
upload_artefacts: true
71+
build_type: "debug"
72+
debug_level: "release"
73+
74+
build-msbuild-releases:
75+
name: Windows Release Build
76+
77+
needs: check-for-changes
78+
if: needs.check-for-changes.outputs.needs_build == 'true'
79+
80+
uses: ./.github/workflows/msbuild.yml
81+
with:
82+
upload_artefacts: true
83+
build_configuration: "Debug Release"
84+
85+
release:
86+
name: Publish Release
87+
runs-on: ubuntu-latest
88+
89+
needs: [build-msbuild-releases, build-meson-releases]
90+
91+
steps:
92+
- name: Checkout code
93+
uses: actions/checkout@v3
94+
95+
- name: fetch tags
96+
run: git fetch --tags origin
97+
98+
- name: Bundle Release Assets
99+
uses: ./.github/actions/bundle_release
100+
101+
- name: Get Date
102+
id: get_date
103+
run: |
104+
echo "CURRENT_DATE=$(date +'%d-%m-%Y')" >> $GITHUB_OUTPUT
105+
106+
- name: Check if a nightly release exists
107+
id: check_nightly
108+
run: |
109+
gh release view nightly --repo ${{ github.repository }}
110+
if [ $? -eq 0 ] ; then
111+
echo "release_exists=true" >> $GITHUB_OUTPUT;
112+
else
113+
echo "release_exists=false" >> $GITHUB_OUTPUT;
114+
fi
115+
shell: bash
116+
continue-on-error: true
117+
env:
118+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119+
120+
- name: Get commit SHA of the last nightly release
121+
id: get_commit_sha
122+
if: steps.check_nightly.outputs.release_exists
123+
run: |
124+
prev_sha=$(git rev-parse nightly)
125+
echo "prev_SHA=$prev_sha" >> $GITHUB_OUTPUT;
126+
127+
- name: Update tag pointing to the previous nightly release
128+
if: steps.check_nightly.outputs.release_exists
129+
run: |
130+
curl -X PATCH \
131+
-H "Authorization: Bearer ${{ secrets.WORKFLOW_TOKEN }}" \
132+
-H "Accept: application/vnd.github.v3+json" \
133+
https://api.github.com/repos/${{ github.repository }}/git/refs/tags/${{ env.PREV_TAG }} \
134+
-d '{
135+
"sha": "${{ steps.get_commit_sha.outputs.prev_SHA }}"
136+
}'
137+
138+
- name: Delete the existing nightly tag and release
139+
if: steps.check_nightly.outputs.release_exists
140+
run: |
141+
gh release delete nightly -y --cleanup-tag
142+
env:
143+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
144+
145+
- name: Create a new nightly release
146+
id: create_release
147+
run: |
148+
gh release create nightly \
149+
--title "Nightly Development Build (${{ steps.get_date.outputs.CURRENT_DATE }})" \
150+
--generate-notes \
151+
${{steps.check_nightly.outputs.release_exists && format('--notes-start-tag {0}', env.PREV_TAG) || ''}} \
152+
--prerelease \
153+
'CortexCommand.windows.zip#Cortex Command [Nightly Build] (Windows Release)' \
154+
'CortexCommand.linux.zip#Cortex Command [Nightly Build] (Linux Release)' \
155+
'CortexCommand.macos.zip#Cortex Command [Nightly Build] (macOS Release)'
156+
env:
157+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)