Skip to content

Commit 0ef01a2

Browse files
authored
Merge branch 'development' into filesystem-functions
2 parents 629842b + c343b50 commit 0ef01a2

File tree

19 files changed

+489
-84
lines changed

19 files changed

+489
-84
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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 -j CortexCommand.windows.zip \
21+
"release/Cortex Command.exe" \
22+
external/lib/win/{fmod,SDL2}.dll
23+
24+
- name: Compress Linux Release
25+
shell: bash
26+
run: |
27+
zip -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 -j CortexCommand.macos.zip \
35+
"release/CortexCommand (macOS)/CortexCommand" \
36+
external/lib/macos/libfmod.dylib
37+
38+
- name: Package Data files
39+
shell: bash
40+
run: |
41+
zip -r -u CortexCommand.windows.zip Data
42+
zip -r -u CortexCommand.linux.zip Data
43+
zip -r -u CortexCommand.macos.zip Data
44+
45+
46+
47+
48+
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: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
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_build.outputs.needs_build }}
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v3
27+
28+
- name: fetch tags
29+
run: git fetch --tags origin
30+
31+
- name: Check if tags point to the same commit or if the workflow was manually triggered
32+
id: check_build
33+
run: |
34+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
35+
echo "Workflow dispatched manually. Continuing..."
36+
echo "needs_build=true" >> $GITHUB_OUTPUT;
37+
else
38+
curr_sha=$(git rev-parse HEAD)
39+
prev_sha=$(git rev-parse ${{ env.PREV_TAG }})
40+
41+
if [[ "$curr_sha" == "$prev_sha" ]]; then
42+
echo "No changes since last nightly release. Exiting..."
43+
echo "needs_build=false" >> $GITHUB_OUTPUT;
44+
else
45+
echo "Changes since last nightly release detected. Continuing..."
46+
echo "needs_build=true" >> $GITHUB_OUTPUT;
47+
fi
48+
fi
49+
50+
build-meson-releases:
51+
name: Linux & macOS Release Builds
52+
53+
needs: check-for-changes
54+
if: needs.check-for-changes.outputs.needs_build == 'true'
55+
56+
uses: ./.github/workflows/meson.yml
57+
with:
58+
upload_artefacts: true
59+
60+
build-msbuild-releases:
61+
name: Windows Release Build
62+
63+
needs: check-for-changes
64+
if: needs.check-for-changes.outputs.needs_build == 'true'
65+
66+
uses: ./.github/workflows/msbuild.yml
67+
with:
68+
upload_artefacts: true
69+
70+
release:
71+
name: Publish Release
72+
runs-on: ubuntu-latest
73+
74+
needs: [build-msbuild-releases, build-meson-releases]
75+
76+
steps:
77+
- name: Checkout code
78+
uses: actions/checkout@v3
79+
80+
- name: fetch tags
81+
run: git fetch --tags origin
82+
83+
- run: mkdir release
84+
85+
- name: Download build artefacts
86+
uses: actions/download-artifact@v3
87+
with:
88+
path: release
89+
90+
- run: ls -R release
91+
92+
- name: Compress Windows Release
93+
run: |
94+
zip -j CortexCommand.windows.zip \
95+
"release/Cortex Command.exe" \
96+
external/lib/win/{fmod,SDL2}.dll
97+
98+
- name: Compress Linux Release
99+
run: |
100+
zip -j CortexCommand.linux.zip \
101+
"release/CortexCommand (Linux)/CortexCommand.AppImage" \
102+
external/lib/linux/x86_64/libfmod.so*
103+
104+
- name: Compress OSX Release
105+
run: |
106+
zip -j CortexCommand.macos.zip \
107+
"release/CortexCommand (macOS)/CortexCommand" \
108+
external/lib/macos/libfmod.dylib
109+
110+
- name: Package Data files
111+
run: |
112+
zip -r -u CortexCommand.windows.zip Data
113+
zip -r -u CortexCommand.linux.zip Data
114+
zip -r -u CortexCommand.macos.zip Data
115+
116+
- name: Get Date
117+
id: get_date
118+
run: |
119+
echo "CURRENT_DATE=$(date +'%d-%m-%Y')" >> $GITHUB_OUTPUT
120+
121+
- name: Check if a nightly release exists
122+
id: check_nightly
123+
run: |
124+
gh release view nightly --repo ${{ github.repository }}
125+
if [ $? -eq 0 ] ; then
126+
echo "release_exists=true" >> $GITHUB_OUTPUT;
127+
else
128+
echo "release_exists=false" >> $GITHUB_OUTPUT;
129+
fi
130+
shell: bash
131+
continue-on-error: true
132+
env:
133+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
134+
135+
- name: Delete old nightly release if it exists
136+
if: steps.check_nightly.outputs.release_exists
137+
run: |
138+
gh release delete nightly -y
139+
env:
140+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
141+
142+
- name: Get commit SHA
143+
id: get_commit_sha
144+
if: steps.check_nightly.outputs.release_exists
145+
run: |
146+
prev_sha=$(git rev-parse nightly)
147+
echo "prev_SHA=$prev_sha" >> $GITHUB_OUTPUT;
148+
149+
- name: Update tag pointing to the previous nightly release
150+
if: steps.check_nightly.outputs.release_exists
151+
run: |
152+
curl -X PATCH \
153+
-H "Authorization: Bearer ${{ secrets.WORKFLOW_TOKEN }}" \
154+
-H "Accept: application/vnd.github.v3+json" \
155+
https://api.github.com/repos/${{ github.repository }}/git/refs/tags/${{ env.PREV_TAG }} \
156+
-d '{
157+
"sha": "${{ steps.get_commit_sha.outputs.prev_SHA }}"
158+
}'
159+
160+
- name: Remove current nightly tag before release
161+
if: steps.check_nightly.outputs.release_exists
162+
run: |
163+
git tag -d nightly
164+
git push origin :refs/tags/nightly
165+
166+
- name: Create Release if it does not exist
167+
id: create_release
168+
run: |
169+
gh release create nightly \
170+
--title "Nightly Development Build (${{ steps.get_date.outputs.CURRENT_DATE }})" \
171+
--generate-notes \
172+
${{steps.check_nightly.outputs.release_exists && format('--notes-start-tag {0}', env.PREV_TAG) || ''}} \
173+
--prerelease \
174+
'CortexCommand.windows.zip#Cortex Command [Nightly Build] (Windows Release)' \
175+
'CortexCommand.linux.zip#Cortex Command [Nightly Build] (Linux Release)' \
176+
'CortexCommand.macos.zip#Cortex Command [Nightly Build] (macOS Release)'
177+
env:
178+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)