1
+ name : Weekly Release
2
+
3
+ permissions :
4
+ contents : write
5
+ pull-requests : write
6
+
7
+ on :
8
+ workflow_dispatch :
9
+ inputs :
10
+ force_changed :
11
+ description : ' Force build'
12
+ required : false
13
+ default : ' false'
14
+ type : choice
15
+ options :
16
+ - ' false'
17
+ - ' true'
18
+ schedule :
19
+ - cron : ' 0 8 * * 1'
20
+
21
+ concurrency :
22
+ group : ${{ github.workflow }}-${{ github.ref }}
23
+ cancel-in-progress : true
24
+
25
+ jobs :
26
+ detect-scm-changes :
27
+ runs-on : ubuntu-latest
28
+ outputs :
29
+ changed : ${{ steps.check.outputs.changed }}
30
+ steps :
31
+ - uses : actions/checkout@v4
32
+ with :
33
+ fetch-depth : 0
34
+ fetch-tags : true
35
+ - id : check
36
+ run : |
37
+ if [ "${{ github.event.inputs.force_changed }}" = "true" ]; then
38
+ echo "changed=true" >> $GITHUB_OUTPUT
39
+ exit 0
40
+ fi
41
+
42
+ echo LAST TAG:
43
+ git describe --tags --abbrev=0 2>/dev/null || echo ""
44
+
45
+ LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
46
+ if [ -z "$LAST_TAG" ]; then
47
+ echo "changed=true" >> $GITHUB_OUTPUT
48
+ exit 0
49
+ fi
50
+ CHANGED=$(git diff --name-only $LAST_TAG..HEAD | grep -v '.github/workflows/' | wc -l)
51
+ if [ "$CHANGED" -eq "0" ]; then
52
+ echo "changed=false" >> $GITHUB_OUTPUT
53
+ else
54
+ echo "changed=true" >> $GITHUB_OUTPUT
55
+ fi
56
+
57
+ calculate-version :
58
+ name : Generate version files
59
+ runs-on : ubuntu-latest
60
+ steps :
61
+ - name : Checkout repository
62
+ uses : actions/checkout@v4
63
+ with :
64
+ fetch-depth : 0
65
+ fetch-tags : true
66
+
67
+ - name : Create Version Files
68
+ run : |
69
+ BASE_TAG=$(cat .github/workflows/base-version.txt)
70
+ IFS='.' read -r major minor patch <<<"$BASE_TAG"
71
+ CURRENT_TAG=$(git tag --list "$major.$minor*" --sort=-v:refname | head -n1)
72
+
73
+ if [ -z "$CURRENT_TAG" ]; then
74
+ CURRENT_TAG="$BASE_TAG"
75
+ NEXT_TAG="$BASE_TAG"
76
+ else
77
+ IFS='.' read -r major minor patch <<<"$CURRENT_TAG"
78
+ NEXT_TAG="$major.$minor.$((patch+1))"
79
+ fi
80
+
81
+ echo "CURRENT_TAG: $CURRENT_TAG"
82
+ echo "NEXT_TAG: $NEXT_TAG"
83
+
84
+ echo "$CURRENT_TAG" > current_tag.txt
85
+ echo "$NEXT_TAG" > next_tag.txt
86
+
87
+ - name : Upload version files
88
+ uses : actions/upload-artifact@v4
89
+ with :
90
+ name : version_files
91
+ path : |
92
+ next_tag.txt
93
+ current_tag.txt
94
+
95
+ build-generals :
96
+ needs : [detect-scm-changes, calculate-version]
97
+ if : needs.detect-scm-changes.outputs.changed == 'true'
98
+ name : Build Generals${{ matrix.preset && '' }}
99
+ strategy :
100
+ matrix :
101
+ include :
102
+ - preset : " vc6"
103
+ tools : true
104
+ extras : true
105
+ release : true
106
+ - preset : " win32-vcpkg"
107
+ tools : true
108
+ extras : true
109
+ release : true
110
+ fail-fast : false
111
+ uses : ./.github/workflows/build-toolchain.yml
112
+ with :
113
+ game : " Generals"
114
+ preset : ${{ matrix.preset }}
115
+ tools : ${{ matrix.tools }}
116
+ extras : ${{ matrix.extras }}
117
+ release : ${{ matrix.release }}
118
+ secrets : inherit
119
+
120
+ build-generalsmd :
121
+ needs : [detect-scm-changes, calculate-version]
122
+ if : needs.detect-scm-changes.outputs.changed == 'true'
123
+ name : Build GeneralsMD${{ matrix.preset && '' }}
124
+ strategy :
125
+ matrix :
126
+ include :
127
+ - preset : " vc6"
128
+ tools : true
129
+ extras : true
130
+ release : true
131
+ - preset : " win32"
132
+ tools : true
133
+ extras : true
134
+ release : true
135
+ fail-fast : false
136
+ uses : ./.github/workflows/build-toolchain.yml
137
+ with :
138
+ game : " GeneralsMD"
139
+ preset : ${{ matrix.preset }}
140
+ tools : ${{ matrix.tools }}
141
+ extras : ${{ matrix.extras }}
142
+ release : ${{ matrix.release }}
143
+ secrets : inherit
144
+
145
+ create-release :
146
+ name : Create Release
147
+ needs : [ build-generals, build-generalsmd ]
148
+ runs-on : ubuntu-latest
149
+ steps :
150
+ - name : Checkout repository
151
+ uses : actions/checkout@v4
152
+ with :
153
+ fetch-depth : 0
154
+ fetch-tags : true
155
+
156
+ - name : Download version file
157
+ uses : actions/download-artifact@v4
158
+ with :
159
+ name : version_files
160
+
161
+ - name : Read base version
162
+ id : base_version
163
+ run : echo "base_version=$(cat .github/workflows/base-version.txt)" >> $GITHUB_OUTPUT
164
+
165
+ - name : Get latest semver tag
166
+ id : get_tag
167
+ run : echo "current_tag=$(cat current_tag.txt)" >> $GITHUB_OUTPUT
168
+
169
+ - name : Calculate next version
170
+ id : next_version
171
+ run : echo "next_tag=$(cat next_tag.txt)" >> $GITHUB_OUTPUT
172
+
173
+ - name : Collect commits since last release
174
+ id : changelog
175
+ run : |
176
+ TAG=${{ steps.get_tag.outputs.current_tag }}
177
+ NEXT=${{ steps.next_version.outputs.next_tag }}
178
+ if [ "$TAG" == "$NEXT" ]; then
179
+ {
180
+ echo "commits<<EOF"
181
+ git log --pretty=format:"- %s" | head -n10 | grep -v "Sync Generals repos"
182
+ echo "EOF"
183
+ } >> $GITHUB_OUTPUT
184
+ else
185
+ {
186
+ echo "commits<<EOF"
187
+ git log "$TAG"..HEAD --pretty=format:"- %s" | grep -v "Sync Generals repos"
188
+ echo "EOF"
189
+ } >> $GITHUB_OUTPUT
190
+ fi
191
+
192
+ # Generals vc6
193
+ - name : Download Generals VC6 Artifacts
194
+ uses : actions/download-artifact@v4
195
+ with :
196
+ name : Generals-vc6+t+e
197
+ path : generals-vc6-artifacts
198
+
199
+ - name : Prepare and Zip Generals VC6
200
+ run : |
201
+ mkdir generals-vc6-release
202
+ cp generals-vc6-artifacts/generalsv.exe generals-vc6-release/GeneralsV.exe
203
+ cp generals-vc6-artifacts/W3DViewV.exe generals-vc6-release/W3DViewV.exe
204
+ cp generals-vc6-artifacts/WorldBuilderV.exe generals-vc6-release/WorldBuilderV.exe
205
+ zip -j generals-vc6-${{ steps.next_version.outputs.next_tag }}.zip generals-vc6-release/*
206
+
207
+ # Generals win32
208
+ - name : Download Generals Win32 Artifacts
209
+ uses : actions/download-artifact@v4
210
+ with :
211
+ name : Generals-win32-vcpkg+t+e
212
+ path : generals-win32-artifacts
213
+
214
+ - name : Prepare and Zip Generals Win32
215
+ run : |
216
+ mkdir generals-win32-release
217
+ cp generals-win32-artifacts/generalsv.exe generals-win32-release/GeneralsV.exe
218
+ cp generals-win32-artifacts/W3DViewV.exe generals-win32-release/W3DViewV.exe
219
+ cp generals-win32-artifacts/WorldBuilderV.exe generals-win32-release/WorldBuilderV.exe
220
+ zip -j generals-win32-${{ steps.next_version.outputs.next_tag }}.zip generals-win32-release/*
221
+
222
+ # GeneralsMD vc6
223
+ - name : Download GeneralsMD VC6 Artifacts
224
+ uses : actions/download-artifact@v4
225
+ with :
226
+ name : GeneralsMD-vc6+t+e
227
+ path : generalsmd-vc6-artifacts
228
+
229
+ - name : Prepare and Zip GeneralsMD VC6
230
+ run : |
231
+ mkdir generalsmd-vc6-release
232
+ cp generalsmd-vc6-artifacts/generalszh.exe generalsmd-vc6-release/GeneralsZHv.exe
233
+ cp generalsmd-vc6-artifacts/W3DViewZH.exe generalsmd-vc6-release/W3DViewZHv.exe
234
+ cp generalsmd-vc6-artifacts/WorldBuilderZH.exe generalsmd-vc6-release/WorldBuilderZHv.exe
235
+ zip -j generalszh-vc6-${{ steps.next_version.outputs.next_tag }}.zip generalsmd-vc6-release/*
236
+
237
+ # GeneralsMD win32
238
+ - name : Download GeneralsMD Win32 Artifacts
239
+ uses : actions/download-artifact@v4
240
+ with :
241
+ name : GeneralsMD-win32+t+e
242
+ path : generalsmd-win32-artifacts
243
+
244
+ - name : Prepare and Zip GeneralsMD Win32
245
+ run : |
246
+ mkdir generalsmd-win32-release
247
+ cp generalsmd-win32-artifacts/generalszh.exe generalsmd-win32-release/GeneralsZHv.exe
248
+ cp generalsmd-win32-artifacts/W3DViewZH.exe generalsmd-win32-release/W3DViewZHv.exe
249
+ cp generalsmd-win32-artifacts/WorldBuilderZH.exe generalsmd-win32-release/WorldBuilderZHv.exe
250
+ zip -j generalszh-win32-${{ steps.next_version.outputs.next_tag }}.zip generalsmd-win32-release/*
251
+
252
+ - name : Create GitHub Release
253
+ uses : softprops/action-gh-release@v2
254
+ with :
255
+ tag_name : ${{ steps.next_version.outputs.next_tag }}
256
+ name : ${{ steps.next_version.outputs.next_tag }}
257
+ body : |
258
+ ## Build notes
259
+
260
+ - **VC6 builds**: May be less compatible with modern systems, but guarantee compatibility with the original binary for multiplayer.
261
+ - **Win32 builds**: Offer better compatibility with modern systems, but multiplayer will only work with other win32 builds.
262
+
263
+ ### Known issues
264
+
265
+ - Fullscreen execution can freeze the game. For that case, you should add the `-win` parameter to run the game in windowed mode.
266
+
267
+ ### Changelog
268
+ ${{ steps.changelog.outputs.commits }}
269
+ files : |
270
+ generals-vc6-${{ steps.next_version.outputs.next_tag }}.zip
271
+ generals-win32-${{ steps.next_version.outputs.next_tag }}.zip
272
+ generalszh-vc6-${{ steps.next_version.outputs.next_tag }}.zip
273
+ generalszh-win32-${{ steps.next_version.outputs.next_tag }}.zip
274
+ env :
275
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
276
+
277
+ - name : Clean up release folders
278
+ if : always()
279
+ run : |
280
+ rm -rf generals-vc6-release generals-win32-release generalsmd-vc6-release generalsmd-win32-release
281
+ rm -rf generals-vc6-artifacts generals-win32-artifacts generalsmd-vc6-artifacts generalsmd-win32-artifacts
282
+ rm -f generals-vc6-${{ steps.next_version.outputs.next_tag }}.zip
283
+ rm -f generals-win32-${{ steps.next_version.outputs.next_tag }}.zip
284
+ rm -f generalszh-vc6-${{ steps.next_version.outputs.next_tag }}.zip
285
+ rm -f generalszh-win32-${{ steps.next_version.outputs.next_tag }}.zip
0 commit comments