1010
1111env :
1212 BUILD_TYPE : RelWithDebInfo
13- BUILD_VERSION : OpenGothic v1.0.${{ github.run_number + 3623 }} # offset to continue from AppVeyor
13+ BUILD_OFFSET : 3623 # continue from AppVeyor build numbers
1414
1515jobs :
16+ setup :
17+ runs-on : ubuntu-latest
18+ outputs :
19+ version : ${{ steps.version.outputs.version }}
20+ semver : ${{ steps.version.outputs.semver }}
21+ steps :
22+ - id : version
23+ run : |
24+ echo "version=OpenGothic v1.0.$((GITHUB_RUN_NUMBER + BUILD_OFFSET))" >> $GITHUB_OUTPUT
25+ echo "semver=1.0.$((GITHUB_RUN_NUMBER + BUILD_OFFSET))" >> $GITHUB_OUTPUT
26+
1627 linux :
28+ needs : setup
1729 runs-on : ubuntu-24.04
1830 steps :
1931 - uses : actions/checkout@v4
2840 - name : Generate build version
2941 run : |
3042 echo '#pragma once' > game/build.h
31- echo "static const char* appBuild = \"${{ env.BUILD_VERSION }}\";" >> game/build.h
43+ echo "static const char* appBuild = \"${{ needs.setup.outputs.version }}\";" >> game/build.h
3244
3345 - name : Configure
3446 run : cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
@@ -39,10 +51,11 @@ jobs:
3951 - name : Upload artifact
4052 uses : actions/upload-artifact@v4
4153 with :
42- name : opengothic_linux_x64
54+ name : opengothic_${{ needs.setup.outputs.semver }}_linux_x64
4355 path : build/opengothic/Gothic2Notr
4456
4557 linux-deb :
58+ needs : setup
4659 runs-on : ubuntu-24.04
4760 steps :
4861 - uses : actions/checkout@v4
@@ -58,20 +71,22 @@ jobs:
5871 - name : Generate build version
5972 run : |
6073 echo '#pragma once' > game/build.h
61- echo "static const char* appBuild = \"${{ env.BUILD_VERSION }}\";" >> game/build.h
74+ echo "static const char* appBuild = \"${{ needs.setup.outputs.version }}\";" >> game/build.h
75+ dch -v "${{ needs.setup.outputs.semver }}" -D unstable -M "Automated build"
6276
6377 - name : Build Debian package
6478 run : |
6579 dpkg-buildpackage -us -uc -b
66- cp ../opengothic_*.deb opengothic_x64 .deb
80+ cp ../opengothic_*.deb opengothic_${{ needs.setup.outputs.semver }}_linux_x64 .deb
6781
6882 - name : Upload artifact
6983 uses : actions/upload-artifact@v4
7084 with :
71- name : opengothic_linux_deb
72- path : opengothic_x64 .deb
85+ name : opengothic_${{ needs.setup.outputs.semver }}_linux_x64.deb
86+ path : opengothic_${{ needs.setup.outputs.semver }}_linux_x64 .deb
7387
7488 windows :
89+ needs : setup
7590 runs-on : windows-2025
7691 defaults :
7792 run :
96111 shell : pwsh
97112 run : |
98113 echo '#pragma once' > game/build.h
99- echo "static const char* appBuild = `"${{ env.BUILD_VERSION }}`";" >> game/build.h
114+ echo "static const char* appBuild = `"${{ needs.setup.outputs.version }}`";" >> game/build.h
100115
101116 - name : Configure
102117 run : cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
@@ -113,13 +128,14 @@ jobs:
113128 - name : Upload artifact
114129 uses : actions/upload-artifact@v4
115130 with :
116- name : opengothic_win_x64
131+ name : opengothic_${{ needs.setup.outputs.semver }}_win_x64
117132 path : |
118133 build/opengothic/*.exe
119134 build/opengothic/*.dll
120135 build/opengothic/*.bat
121136
122137 macos-arm64 :
138+ needs : setup
123139 runs-on : macos-15
124140 steps :
125141 - uses : actions/checkout@v4
@@ -132,7 +148,7 @@ jobs:
132148 - name : Generate build version
133149 run : |
134150 echo '#pragma once' > game/build.h
135- echo "static const char* appBuild = \"${{ env.BUILD_VERSION }}\";" >> game/build.h
151+ echo "static const char* appBuild = \"${{ needs.setup.outputs.version }}\";" >> game/build.h
136152
137153 - name : Workaround for missing fp.h on modern macOS
138154 run : |
@@ -148,11 +164,12 @@ jobs:
148164 - name : Upload artifact
149165 uses : actions/upload-artifact@v4
150166 with :
151- name : opengothic_osx_arm64
167+ name : opengothic_${{ needs.setup.outputs.semver }}_osx_arm64
152168 path : |
153169 build/opengothic/Gothic2Notr
154170
155171 macos-x64 :
172+ needs : setup
156173 runs-on : macos-15-intel
157174 steps :
158175 - uses : actions/checkout@v4
@@ -165,7 +182,7 @@ jobs:
165182 - name : Generate build version
166183 run : |
167184 echo '#pragma once' > game/build.h
168- echo "static const char* appBuild = \"${{ env.BUILD_VERSION }}\";" >> game/build.h
185+ echo "static const char* appBuild = \"${{ needs.setup.outputs.version }}\";" >> game/build.h
169186
170187 - name : Workaround for missing fp.h on modern macOS
171188 run : |
@@ -181,13 +198,13 @@ jobs:
181198 - name : Upload artifact
182199 uses : actions/upload-artifact@v4
183200 with :
184- name : opengothic_osx_x64
201+ name : opengothic_${{ needs.setup.outputs.semver }}_osx_x64
185202 path : |
186203 build/opengothic/Gothic2Notr
187204
188205 release :
189206 if : startsWith(github.ref, 'refs/tags/')
190- needs : [linux, linux-deb, windows, macos-arm64, macos-x64]
207+ needs : [setup, linux, linux-deb, windows, macos-arm64, macos-x64]
191208 runs-on : ubuntu-24.04
192209 permissions :
193210 contents : write
@@ -198,20 +215,22 @@ jobs:
198215 path : artifacts
199216
200217 - name : Package release archives
218+ env :
219+ VERSION : ${{ needs.setup.outputs.semver }}
201220 run : |
202- cd artifacts/opengothic_linux_x64 && zip -r ../opengothic_linux_x64 .zip . && cd ../..
203- cd artifacts/opengothic_win_x64 && zip -r ../opengothic_win_x64 .zip . && cd ../..
204- cd artifacts/opengothic_osx_arm64 && zip -r ../opengothic_osx_arm64 .zip . && cd ../..
205- cd artifacts/opengothic_osx_x64 && zip -r ../opengothic_osx_x64 .zip . && cd ../..
221+ cd artifacts/opengothic_${VERSION}_linux_x64 && zip -r ../opengothic_${VERSION}_linux_x64 .zip . && cd ../..
222+ cd artifacts/opengothic_${VERSION}_win_x64 && zip -r ../opengothic_${VERSION}_win_x64 .zip . && cd ../..
223+ cd artifacts/opengothic_${VERSION}_osx_arm64 && zip -r ../opengothic_${VERSION}_osx_arm64 .zip . && cd ../..
224+ cd artifacts/opengothic_${VERSION}_osx_x64 && zip -r ../opengothic_${VERSION}_osx_x64 .zip . && cd ../..
206225
207226 - name : Create Release
208227 uses : softprops/action-gh-release@v2
209228 with :
210229 draft : true
211230 prerelease : true
212231 files : |
213- artifacts/opengothic_linux_x64 .zip
214- artifacts/opengothic_linux_deb/opengothic_linux_x64 .deb
215- artifacts/opengothic_win_x64 .zip
216- artifacts/opengothic_osx_arm64 .zip
217- artifacts/opengothic_osx_x64 .zip
232+ artifacts/opengothic_${{ needs.setup.outputs.semver }}_linux_x64 .zip
233+ artifacts/opengothic_${{ needs.setup.outputs.semver }}_linux_x64.deb/opengothic_${{ needs.setup.outputs.semver }}_linux_x64 .deb
234+ artifacts/opengothic_${{ needs.setup.outputs.semver }}_win_x64 .zip
235+ artifacts/opengothic_${{ needs.setup.outputs.semver }}_osx_arm64 .zip
236+ artifacts/opengothic_${{ needs.setup.outputs.semver }}_osx_x64 .zip
0 commit comments