-
Notifications
You must be signed in to change notification settings - Fork 115
226 lines (190 loc) · 7.08 KB
/
build.yml
File metadata and controls
226 lines (190 loc) · 7.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
name: Build
on:
push:
branches: [master]
tags: ['*']
pull_request:
branches: [master]
workflow_dispatch:
env:
BUILD_TYPE: RelWithDebInfo
BUILD_OFFSET: 3623 # continue from AppVeyor build numbers
jobs:
setup:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
semver: ${{ steps.version.outputs.semver }}
steps:
- id: version
run: |
echo "version=OpenGothic v1.0.$((GITHUB_RUN_NUMBER + BUILD_OFFSET))" >> $GITHUB_OUTPUT
echo "semver=1.0.$((GITHUB_RUN_NUMBER + BUILD_OFFSET))" >> $GITHUB_OUTPUT
linux:
needs: setup
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y glslang-tools libvulkan-dev libasound2-dev libx11-dev libxcursor-dev
- name: Generate build version
run: |
echo '#pragma once' > game/build.h
echo "static const char* appBuild = \"${{ needs.setup.outputs.version }}\";" >> game/build.h
- name: Configure
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
- name: Build
run: cmake --build build --target Gothic2Notr -j $(nproc)
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: opengothic_${{ needs.setup.outputs.semver }}_linux_x64
path: build/opengothic/Gothic2Notr
linux-deb:
needs: setup
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential devscripts debhelper cmake g++ \
glslang-tools libvulkan-dev libasound2-dev libx11-dev libxcursor-dev
- name: Generate build version
run: |
echo '#pragma once' > game/build.h
echo "static const char* appBuild = \"${{ needs.setup.outputs.version }}\";" >> game/build.h
dch -v "${{ needs.setup.outputs.semver }}" -D unstable -M "Automated build"
- name: Build Debian package
run: |
dpkg-buildpackage -us -uc -b
cp ../opengothic_*.deb opengothic_${{ needs.setup.outputs.semver }}_linux_x64.deb
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: opengothic_${{ needs.setup.outputs.semver }}_linux_x64.deb
path: opengothic_${{ needs.setup.outputs.semver }}_linux_x64.deb
windows:
needs: setup
runs-on: windows-2025
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
mingw-w64-x86_64-glslang
mingw-w64-x86_64-vulkan-devel
- name: Generate build version
shell: pwsh
run: |
echo '#pragma once' > game/build.h
echo "static const char* appBuild = `"${{ needs.setup.outputs.version }}`";" >> game/build.h
- name: Configure
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
- name: Build
run: cmake --build build --target Gothic2Notr
- name: Copy runtime DLLs
run: |
cp "$MINGW_PREFIX/bin/libgcc_s_seh-1.dll" build/opengothic/
cp "$MINGW_PREFIX/bin/libstdc++-6.dll" build/opengothic/
cp "$MINGW_PREFIX/bin/libwinpthread-1.dll" build/opengothic/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: opengothic_${{ needs.setup.outputs.semver }}_win_x64
path: |
build/opengothic/*.exe
build/opengothic/*.dll
build/opengothic/*.bat
macos-arm64:
needs: setup
runs-on: macos-15
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: brew install glslang molten-vk
- name: Generate build version
run: |
echo '#pragma once' > game/build.h
echo "static const char* appBuild = \"${{ needs.setup.outputs.version }}\";" >> game/build.h
- name: Configure
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
- name: Build
run: cmake --build build --target Gothic2Notr -j $(sysctl -n hw.ncpu)
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: opengothic_${{ needs.setup.outputs.semver }}_osx_arm64
path: |
build/opengothic/Gothic2Notr
macos-x64:
needs: setup
runs-on: macos-15-intel
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: brew install glslang molten-vk
- name: Generate build version
run: |
echo '#pragma once' > game/build.h
echo "static const char* appBuild = \"${{ needs.setup.outputs.version }}\";" >> game/build.h
- name: Configure
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
- name: Build
run: cmake --build build --target Gothic2Notr -j $(sysctl -n hw.ncpu)
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: opengothic_${{ needs.setup.outputs.semver }}_osx_x64
path: |
build/opengothic/Gothic2Notr
release:
if: startsWith(github.ref, 'refs/tags/')
needs: [setup, linux, linux-deb, windows, macos-arm64, macos-x64]
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Package release archives
env:
VERSION: ${{ needs.setup.outputs.semver }}
run: |
cd artifacts/opengothic_${VERSION}_linux_x64 && zip -r ../opengothic_${VERSION}_linux_x64.zip . && cd ../..
cd artifacts/opengothic_${VERSION}_win_x64 && zip -r ../opengothic_${VERSION}_win_x64.zip . && cd ../..
cd artifacts/opengothic_${VERSION}_osx_arm64 && zip -r ../opengothic_${VERSION}_osx_arm64.zip . && cd ../..
cd artifacts/opengothic_${VERSION}_osx_x64 && zip -r ../opengothic_${VERSION}_osx_x64.zip . && cd ../..
- name: Create Release
uses: softprops/action-gh-release@v2
with:
draft: true
prerelease: true
files: |
artifacts/opengothic_${{ needs.setup.outputs.semver }}_linux_x64.zip
artifacts/opengothic_${{ needs.setup.outputs.semver }}_linux_x64.deb/opengothic_${{ needs.setup.outputs.semver }}_linux_x64.deb
artifacts/opengothic_${{ needs.setup.outputs.semver }}_win_x64.zip
artifacts/opengothic_${{ needs.setup.outputs.semver }}_osx_arm64.zip
artifacts/opengothic_${{ needs.setup.outputs.semver }}_osx_x64.zip