4
4
push :
5
5
paths-ignore :
6
6
- ' **.md'
7
+ - ' .github/**'
7
8
8
9
pull_request :
9
10
types : [opened, reopened, synchronize]
10
11
release :
11
12
types : [published]
13
+ workflow_dispatch :
12
14
13
15
jobs :
14
16
windows :
15
17
name : ' Windows'
16
- runs-on : windows-2019
18
+ runs-on : windows-2025
17
19
18
20
env :
19
21
solution : ' msvc/ReGameDLL.sln'
@@ -23,19 +25,58 @@ jobs:
23
25
buildTests : ' Tests'
24
26
25
27
steps :
28
+ - name : Configure
29
+ run : git config --global --add safe.directory "$GITHUB_WORKSPACE"
30
+
26
31
- name : Checkout
27
32
uses : actions/checkout@v4
28
33
with :
29
34
fetch-depth : 0
30
35
31
36
- name : Setup MSBuild
32
37
uses : microsoft/setup-msbuild@v2
33
- with :
34
- vs-version : ' 16'
38
+
39
+ # TODO: add support of 141_xp toolchain at VS2022+
40
+ # - name: Install v140, v141 and v142 toolsets
41
+ # shell: cmd
42
+ # run: |
43
+ # "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" modify ^
44
+ # --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" ^
45
+ # --add Microsoft.VisualStudio.Component.WindowsXP ^
46
+ # --add Microsoft.VisualStudio.Component.VC.v140 ^
47
+ # --add Microsoft.VisualStudio.Component.VC.v140.x86.x64 ^
48
+ # --add Microsoft.VisualStudio.Component.VC.v140.xp ^
49
+ # --add Microsoft.VisualStudio.Component.VC.140.CRT ^
50
+ # --add Microsoft.VisualStudio.Component.VC.v141 ^
51
+ # --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 ^
52
+ # --add Microsoft.VisualStudio.Component.VC.v141.xp ^
53
+ # --add Microsoft.VisualStudio.Component.VC.v142 ^
54
+ # --add Microsoft.VisualStudio.Component.VC.v142.x86.x64 ^
55
+ # --quiet --norestart
56
+
57
+ - name : Select PlatformToolset
58
+ id : select_toolset
59
+ shell : pwsh
60
+ run : |
61
+ $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
62
+ $vs2019 = & $vswhere -products * -version "[16.0,17.0)" -property installationPath -latest
63
+ $vs2022 = & $vswhere -products * -version "[17.0,)" -property installationPath -latest
64
+
65
+ if ($vs2019) {
66
+ "toolset=v140_xp" >> $env:GITHUB_OUTPUT
67
+ Write-Host "Selected v140_xp toolset"
68
+ } elseif ($vs2022) {
69
+ "toolset=v143" >> $env:GITHUB_OUTPUT
70
+ Write-Host "Selected v143 toolset"
71
+ } else {
72
+ Write-Error "No suitable Visual Studio installation found"
73
+ exit 1
74
+ }
35
75
36
76
- name : Build and Run unittests
37
77
run : |
38
- msbuild ${{ env.solution }} -p:Configuration="${{ env.buildTests }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false
78
+ $toolset = '${{ steps.select_toolset.outputs.toolset }}'
79
+ msbuild ${{ env.solution }} -p:Configuration="${{ env.buildTests }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=$toolset /p:XPDeprecationWarning=false
39
80
.\"msvc\Tests\mp.exe"
40
81
If ($LASTEXITCODE -ne 0 -And
41
82
$LASTEXITCODE -ne 3)
44
85
45
86
- name : Build
46
87
run : |
47
- msbuild ${{ env.solution }} -p:Configuration="${{ env.buildRelease }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false
48
- msbuild ${{ env.solution }} -p:Configuration="${{ env.buildReleasePlay }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false
88
+ $toolset = '${{ steps.select_toolset.outputs.toolset }}'
89
+ msbuild ${{ env.solution }} -p:Configuration="${{ env.buildRelease }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=$toolset /p:XPDeprecationWarning=false
90
+ msbuild ${{ env.solution }} -p:Configuration="${{ env.buildReleasePlay }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=$toolset /p:XPDeprecationWarning=false
91
+ - name : Get rcedit from chocolatey
92
+ shell : pwsh
93
+ run : |
94
+ choco install rcedit -y
49
95
50
96
- name : Move files
51
97
run : |
@@ -56,6 +102,49 @@ jobs:
56
102
move msvc\${{ env.buildRelease }}\mp.dll publish\bin\win32\cstrike\dlls\mp.dll
57
103
move msvc\${{ env.buildRelease }}\mp.pdb publish\debug\mp.pdb
58
104
105
+ - name : Get app version
106
+ id : get_version
107
+ shell : pwsh
108
+ run : |
109
+ $versionFile = "regamedll/version/appversion.h"
110
+ if (-not (Test-Path $versionFile)) {
111
+ Write-Error "Version file not found: $versionFile"
112
+ exit 1
113
+ }
114
+
115
+ $content = Get-Content $versionFile
116
+ foreach ($line in $content) {
117
+ if ($line -match '^\s*#define\s+APP_VERSION\s+"([^"]+)"') {
118
+ $version = $matches[1]
119
+ "version=$version" >> $env:GITHUB_OUTPUT
120
+ Write-Host "Found version: $version"
121
+ exit 0
122
+ }
123
+ }
124
+ Write-Error "APP_VERSION not found in file"
125
+ exit 1
126
+
127
+ - name : Show version
128
+ run : echo "Version is ${{ steps.get_version.outputs.version }}"
129
+
130
+ - name : Import PFX and sign
131
+ if : github.event_name != 'pull_request'
132
+ env :
133
+ KEY_PFX_PASS : ${{ secrets.KEY_PFX_PASS }}
134
+ # https://github.com/actions/runner-images/blob/main/images/windows/Windows2025-Readme.md
135
+ run : |
136
+ $pfxBase64 = "${{ secrets.KEY_PFX_B64 }}"
137
+ [IO.File]::WriteAllBytes("${{ github.workspace }}\signing-cert.pfx", [Convert]::FromBase64String($pfxBase64))
138
+ certutil -f -p "${{ secrets.KEY_PFX_PASS }}" -importPFX "${{ github.workspace }}\signing-cert.pfx"
139
+ & 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "Regamedll_CS is a result of reverse engineering of original library mod HLDS (build 6153beta) using DWARF debug info embedded into linux version of HLDS, cs.so" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha256 /fd sha256 /v ${{ github.workspace }}\publish\bin\win32\cstrike\dlls\mp.dll
140
+ Remove-Item -Recurse -Force "${{ github.workspace }}\signing-cert.pfx"
141
+ shell : " pwsh"
142
+
143
+ - name : Edit resources at windows binaries
144
+ run : |
145
+ rcedit ${{ github.workspace }}\publish\bin\win32\cstrike\dlls\mp.dll --set-version-string ProductName "Regamedll_CS - mp.dll" --set-file-version "${{ steps.get_version.outputs.version }}" --set-product-version "${{ steps.get_version.outputs.version }}" --set-version-string FileDescription "Regamedll_CS (mp.dll) - provide more stable (than official) version of Counter-Strike game with extended API for mods and plugins, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Regamedll_CS is a result of reverse engineering of original library mod HLDS (build 6153beta) using DWARF debug info embedded into linux version of HLDS, cs.so. Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam" --set-icon regamedll/msvc/icon.ico
146
+ shell : " pwsh"
147
+
59
148
- name : Deploy artifacts
60
149
uses : actions/upload-artifact@v4
61
150
with :
@@ -104,11 +193,6 @@ jobs:
104
193
container : debian:11-slim
105
194
106
195
steps :
107
- - name : Checkout
108
- uses : actions/checkout@v4
109
- with :
110
- fetch-depth : 0
111
-
112
196
- name : Install dependencies
113
197
run : |
114
198
dpkg --add-architecture i386
@@ -120,6 +204,58 @@ jobs:
120
204
git cmake rsync \
121
205
g++ gcc
122
206
207
+ - name : Configure
208
+ run : git config --global --add safe.directory "$GITHUB_WORKSPACE"
209
+
210
+ - name : Checkout
211
+ uses : actions/checkout@v4
212
+ with :
213
+ submodules : recursive
214
+ fetch-depth : 0
215
+
216
+ - name : GPG Import
217
+ run : |
218
+ echo "${{ secrets.PUB_ASC }}" > "${{ secrets.PUB_ASC_FILE }}"
219
+ echo "${{ secrets.KEY_ASC }}" > "${{ secrets.KEY_ASC_FILE }}"
220
+
221
+ # Import the public key
222
+ gpg --batch --yes --import "${{ secrets.PUB_ASC_FILE }}"
223
+ if [[ $? -ne 0 ]]; then
224
+ echo "Error: Failed to import the public key"
225
+ exit 1
226
+ fi
227
+
228
+ # Import the private key
229
+ gpg --batch --yes --import "${{ secrets.KEY_ASC_FILE }}"
230
+ if [[ $? -ne 0 ]]; then
231
+ echo "Error: Failed to import the private key"
232
+ exit 2
233
+ fi
234
+
235
+ # Extract the fingerprint of the imported public key
236
+ GPG_LINUX_FINGERPRINT=$(gpg --list-keys --with-colons | grep '^fpr' | head -n 1 | cut -d: -f10)
237
+
238
+ # Check if the fingerprint was extracted
239
+ if [[ -z "$GPG_LINUX_FINGERPRINT" ]]; then
240
+ echo "Error: Failed to extract the fingerprint of the key"
241
+ exit 3
242
+ fi
243
+
244
+ # Set the trust level for the key
245
+ echo "$GPG_LINUX_FINGERPRINT:6:" | gpg --batch --import-ownertrust
246
+ if [ $? -ne 0 ]; then
247
+ echo "Error: Failed to set trust for the key $GPG_LINUX_FINGERPRINT"
248
+ exit 4
249
+ fi
250
+
251
+ echo "Key $GPG_LINUX_FINGERPRINT successfully imported and trusted"
252
+ gpg --list-keys
253
+
254
+ #export for global use
255
+ echo "GPG_LINUX_FINGERPRINT=$GPG_LINUX_FINGERPRINT" >> $GITHUB_ENV
256
+ shell : bash
257
+ if : github.event_name != 'pull_request'
258
+
123
259
- name : Build and Run unittests
124
260
run : |
125
261
rm -rf build && CC=gcc CXX=g++ cmake -DCMAKE_BUILD_TYPE=Unittests -B build && cmake --build build -j8
@@ -216,7 +352,29 @@ jobs:
216
352
run : |
217
353
rsync -a dist/ bin/win32/cstrike
218
354
rsync -a dist/ bin/linux32/cstrike
355
+
356
+ # new runner, niw signs
357
+ echo "${{ secrets.PUB_ASC }}" > "${{ secrets.PUB_ASC_FILE }}"
358
+ echo "${{ secrets.KEY_ASC }}" > "${{ secrets.KEY_ASC_FILE }}"
359
+ gpg --batch --yes --import "${{ secrets.PUB_ASC_FILE }}"
360
+ gpg --batch --yes --import "${{ secrets.KEY_ASC_FILE }}"
361
+ GPG_LINUX_FINGERPRINT=$(gpg --list-keys --with-colons | grep '^fpr' | head -n 1 | cut -d: -f10)
362
+ echo "$GPG_LINUX_FINGERPRINT:6:" | gpg --batch --import-ownertrust
363
+ echo "GPG_LINUX_FINGERPRINT=$GPG_LINUX_FINGERPRINT" >> $GITHUB_ENV
364
+
365
+ sign_file() {
366
+ local file=$1
367
+ gpg --batch --yes --detach-sign --armor -u "$GPG_LINUX_FINGERPRINT" "$file"
368
+ if [ $? -ne 0 ]; then
369
+ echo "Error: Failed to sign $file"
370
+ exit 2
371
+ fi
372
+ echo "$file signed successfully."
373
+ }
374
+
375
+ # Pack and sign final archive
219
376
7z a -tzip regamedll-bin-${{ env.APP_VERSION }}.zip bin/ cssdk/
377
+ sign_file "regamedll-bin-${{ env.APP_VERSION }}.zip"
220
378
221
379
- name : Publish artifacts
222
380
uses : softprops/action-gh-release@v2
@@ -227,6 +385,8 @@ jobs:
227
385
with :
228
386
files : |
229
387
*.zip
388
+ *.7z
389
+ *.asc
230
390
env :
231
391
GITHUB_TOKEN : ${{ secrets.API_TOKEN }}
232
392
0 commit comments