Skip to content

Commit e999171

Browse files
authored
Added codesign and resources (#1069)
* Added codesign and resources - for Windows: rehlds/.github#30 and rehlds/.github#29 - for Linux: rehlds/.github#28
1 parent 20c16bf commit e999171

File tree

2 files changed

+123
-5
lines changed

2 files changed

+123
-5
lines changed

.github/workflows/build.yml

+112-4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ jobs:
4747
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildRelease }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false
4848
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildReleasePlay }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false
4949
50+
- name: Get rcedit from chocolatey
51+
run: |
52+
choco install rcedit -y
53+
shell: "pwsh"
54+
5055
- name: Move files
5156
run: |
5257
mkdir publish\debug
@@ -70,6 +75,39 @@ jobs:
7075
move msvc\${{ env.buildRelease }}\filesystem_stdio.pdb publish\debug\filesystem_stdio.pdb
7176
move msvc\${{ env.buildRelease }}\director.pdb publish\debug\director.pdb
7277
78+
# TODO: Set version to exe dynamicly: 0.0.0.0 to normal version such as at linux
79+
- name: Edit resources at windows binaries
80+
run: |
81+
rcedit ${{ github.workspace }}\publish\bin\win32\hlds.exe --set-version-string ProductName "ReHLDS" --set-file-version "0.0.0.0" --set-product-version "0.0.0.0" --set-version-string FileDescription "The Half-Life Dedicated Server, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam"
82+
rcedit ${{ github.workspace }}\publish\bin\win32\hltv.exe --set-version-string ProductName "ReHLTV" --set-file-version "0.0.0.0" --set-product-version "0.0.0.0" --set-version-string FileDescription "The Half-Life TV, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam"
83+
rcedit ${{ github.workspace }}\publish\tests\swds.dll --set-version-string ProductName "swds.dll" --set-file-version "0.0.0.0" --set-product-version "0.0.0.0" --set-version-string FileDescription "A dll used by Steamworks Dedicated Servers, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam" --set-icon rehlds/dedicated/msvc/icon.ico
84+
rcedit ${{ github.workspace }}\publish\bin\win32\swds.dll --set-version-string ProductName "swds.dll" --set-file-version "0.0.0.0" --set-product-version "0.0.0.0" --set-version-string FileDescription "A ddll used by Steamworks Dedicated Servers, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam" --set-icon rehlds/dedicated/msvc/icon.ico
85+
rcedit ${{ github.workspace }}\publish\bin\win32\core.dll --set-version-string ProductName "core.dll" --set-file-version "0.0.0.0" --set-product-version "0.0.0.0" --set-version-string FileDescription " A dll, it is a core of game engine, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam" --set-icon rehlds/dedicated/msvc/icon.ico
86+
rcedit ${{ github.workspace }}\publish\bin\win32\proxy.dll --set-version-string ProductName "proxy.dll" --set-file-version "0.0.0.0" --set-product-version "0.0.0.0" --set-version-string FileDescription "A dll for proxying network connections, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam" --set-icon rehlds/dedicated/msvc/icon.ico
87+
rcedit ${{ github.workspace }}\publish\bin\win32\demoplayer.dll --set-version-string ProductName "demoplayer.dll" --set-file-version "0.0.0.0" --set-product-version "0.0.0.0" --set-version-string FileDescription "A dll for demoplayer functionality, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam" --set-icon rehlds/dedicated/msvc/icon.ico
88+
rcedit ${{ github.workspace }}\publish\bin\win32\filesystem_stdio.dll --set-version-string ProductName "filesystem_stdio.dll" --set-file-version "0.0.0.0" --set-product-version "0.0.0.0" --set-version-string FileDescription "A dll that manages file input/output operations, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam" --set-icon rehlds/dedicated/msvc/icon.ico
89+
rcedit ${{ github.workspace }}\publish\bin\win32\valve\dlls\director.dll --set-version-string ProductName "director.dll" --set-file-version "0.0.0.0" --set-product-version "0.0.0.0" --set-version-string FileDescription "A dll used for Director functionality in Half-Life 1, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam" --set-icon rehlds/dedicated/msvc/icon.ico
90+
shell: "pwsh"
91+
92+
- name: Import PFX and sign
93+
env:
94+
KEY_PFX_PASS: ${{ secrets.KEY_PFX_PASS}}
95+
run: |
96+
$pfxBase64 = "${{ secrets.KEY_PFX_B64 }}"
97+
[IO.File]::WriteAllBytes("${{ github.workspace }}\signing-cert.pfx", [Convert]::FromBase64String($pfxBase64))
98+
certutil -f -p "${{ secrets.KEY_PFX_PASS }}" -importPFX "${{ github.workspace }}\signing-cert.pfx"
99+
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "ReHLDS" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha512 /fd sha512 /v ${{ github.workspace }}\publish\bin\win32\hlds.exe
100+
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "reHLTV" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha512 /fd sha512 /v ${{ github.workspace }}\publish\bin\win32\hltv.exe
101+
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "ReHLDS - swds.dll" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha512 /fd sha512 /v ${{ github.workspace }}\publish\tests\swds.dll
102+
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "ReHLDS - swds.dll" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha512 /fd sha512 /v ${{ github.workspace }}\publish\bin\win32\swds.dll
103+
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "ReHLDS - core.dll" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha512 /fd sha512 /v ${{ github.workspace }}\publish\bin\win32\core.dll
104+
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "ReHLDS - proxy.dll" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha512 /fd sha512 /v ${{ github.workspace }}\publish\bin\win32\proxy.dll
105+
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "ReHLDS - demoplayer.dll" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha512 /fd sha512 /v ${{ github.workspace }}\publish\bin\win32\demoplayer.dll
106+
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "ReHLDS - filesystem_stdio.dll" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha512 /fd sha512 /v ${{ github.workspace }}\publish\bin\win32\filesystem_stdio.dll
107+
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "ReHLDS - director.dll" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha512 /fd sha512 /v ${{ github.workspace }}\publish\bin\win32\valve\dlls\director.dll
108+
Remove-Item -Recurse -Force "${{ github.workspace }}\signing-cert.pfx"
109+
shell: "pwsh"
110+
73111
- name: Deploy artifacts
74112
uses: actions/upload-artifact@v4
75113
with:
@@ -78,7 +116,7 @@ jobs:
78116

79117
testdemos:
80118
name: 'Test demos'
81-
runs-on: ubuntu-latest
119+
runs-on: ubuntu-24.04
82120
container: rehldsorg/testdemos:latest
83121
needs: [windows]
84122
defaults:
@@ -116,7 +154,7 @@ jobs:
116154

117155
linux:
118156
name: 'Linux'
119-
runs-on: ubuntu-latest
157+
runs-on: ubuntu-24.04
120158
container: debian:11-slim
121159

122160
steps:
@@ -136,6 +174,48 @@ jobs:
136174
git cmake rsync \
137175
g++ gcc
138176
177+
- name: GPG Import
178+
run: |
179+
echo "${{ secrets.PUB_ASC }}" > "${{ secrets.PUB_ASC_FILE }}"
180+
echo "${{ secrets.KEY_ASC }}" > "${{ secrets.KEY_ASC_FILE }}"
181+
182+
# Import the public key
183+
gpg --batch --yes --import "${{ secrets.PUB_ASC_FILE }}"
184+
if [[ $? -ne 0 ]]; then
185+
echo "Error: Failed to import the public key"
186+
exit 1
187+
fi
188+
189+
# Import the private key
190+
gpg --batch --yes --import "${{ secrets.KEY_ASC_FILE }}"
191+
if [[ $? -ne 0 ]]; then
192+
echo "Error: Failed to import the private key"
193+
exit 2
194+
fi
195+
196+
# Extract the fingerprint of the imported public key
197+
GPG_LINUX_FINGERPRINT=$(gpg --list-keys --with-colons | grep '^fpr' | head -n 1 | cut -d: -f10)
198+
199+
# Check if the fingerprint was extracted
200+
if [[ -z "$GPG_LINUX_FINGERPRINT" ]]; then
201+
echo "Error: Failed to extract the fingerprint of the key"
202+
exit 3
203+
fi
204+
205+
# Set the trust level for the key
206+
echo "$GPG_LINUX_FINGERPRINT:6:" | gpg --batch --import-ownertrust
207+
if [ $? -ne 0 ]; then
208+
echo "Error: Failed to set trust for the key $GPG_LINUX_FINGERPRINT"
209+
exit 4
210+
fi
211+
212+
echo "Key $GPG_LINUX_FINGERPRINT successfully imported and trusted"
213+
gpg --list-keys
214+
215+
#export for global use
216+
echo "GPG_LINUX_FINGERPRINT=$GPG_LINUX_FINGERPRINT" >> $GITHUB_ENV
217+
shell: bash
218+
139219
- name: Build and Run unittests
140220
run: |
141221
rm -rf build && cmake -DCMAKE_BUILD_TYPE=Unittests -B build && cmake --build build -j8
@@ -213,7 +293,7 @@ jobs:
213293

214294
publish:
215295
name: 'Publish'
216-
runs-on: ubuntu-latest
296+
runs-on: ubuntu-24.04
217297
needs: [windows, testdemos, linux]
218298

219299
steps:
@@ -241,15 +321,42 @@ jobs:
241321
fi
242322
rm -f appversion.h
243323
244-
- name: Packaging bin/dbg
324+
- name: Final signing and Packaging bin/dbg
245325
id: packaging-job
246326
if: |
247327
github.event_name == 'release' &&
248328
github.event.action == 'published' &&
249329
startsWith(github.ref, 'refs/tags/')
250330
run: |
331+
332+
# new runner, niw signs
333+
echo "${{ secrets.PUB_ASC }}" > "${{ secrets.PUB_ASC_FILE }}"
334+
echo "${{ secrets.KEY_ASC }}" > "${{ secrets.KEY_ASC_FILE }}"
335+
gpg --batch --yes --import "${{ secrets.PUB_ASC_FILE }}"
336+
gpg --batch --yes --import "${{ secrets.KEY_ASC_FILE }}"
337+
GPG_LINUX_FINGERPRINT=$(gpg --list-keys --with-colons | grep '^fpr' | head -n 1 | cut -d: -f10)
338+
echo "$GPG_LINUX_FINGERPRINT:6:" | gpg --batch --import-ownertrust
339+
echo "GPG_LINUX_FINGERPRINT=$GPG_LINUX_FINGERPRINT" >> $GITHUB_ENV
340+
341+
sign_file() {
342+
local file=$1
343+
gpg --batch --yes --detach-sign --armor -u "$GPG_LINUX_FINGERPRINT" "$file"
344+
if [ $? -ne 0 ]; then
345+
echo "Error: Failed to sign $file"
346+
exit 2
347+
fi
348+
echo "$file signed successfully."
349+
}
350+
351+
# Pack and sign final archive
251352
7z a -tzip rehlds-bin-${{ env.APP_VERSION }}.zip bin/ hlsdk/
353+
sign_file "rehlds-bin-${{ env.APP_VERSION }}.zip"
354+
355+
# Pack and sign final archive
252356
7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -aoa rehlds-dbg-${{ env.APP_VERSION }}.7z debug/
357+
sign_file "rehlds-dbg-${{ env.APP_VERSION }}.7z"
358+
359+
shell: bash
253360

254361
- name: Publish artifacts
255362
uses: softprops/action-gh-release@v2
@@ -261,5 +368,6 @@ jobs:
261368
files: |
262369
*.zip
263370
*.7z
371+
*.asc
264372
env:
265373
GITHUB_TOKEN: ${{ secrets.API_TOKEN }}

README.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ Along with reverse engineering, a lot of defects and (potential) bugs were found
88

99
You can try playing on one of many servers that are using ReHLDS: [Game Tracker](http://www.gametracker.com/search/?search_by=server_variable&search_by2=sv_version)
1010

11+
> [!TIP]
12+
> ReHLDS linux-releases now is signed via `GPG`, pubkey is: `63547829004f07716f7be4856c32c4282e60fb67` and could be found at [https://keyserver.ubuntu.com/](https://keyserver.ubuntu.com/pks/lookup?search=63547829004f07716f7be4856c32c4282e60fb67+&fingerprint=on&op=index).
13+
>
14+
> How to:
15+
> 1. [Download](https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x63547829004f07716f7be4856c32c4282e60fb67) `63547829004f07716f7be4856c32c4282e60fb67.asc` key
16+
> 2. Import: `gpg --import 63547829004f07716f7be4856c32c4282e60fb67.asc`
17+
> 3. Download release `archive` and `.asc` file.
18+
> 4. Verify: `gpg --verify some-rehlds.zip.asc some-rehlds.zip`.
19+
1120
## Goals of the project
1221
<ul>
1322
<li>Provide more stable (than official) version of Half-Life dedicated server with extended API for mods and plugins</li>
@@ -17,7 +26,8 @@ You can try playing on one of many servers that are using ReHLDS: [Game Tracker]
1726
## How can use it?
1827
ReHLDS is fully compatible with the official pre-anniversary edition of HLDS (engine version <= 8684) downloaded by steamcmd. All you have to do is to download ReHLDS binaries and replace original swds.dll/engine_i486.so. For windows you can also copy a swds.pdb file with a debug information.
1928

20-
<b>Warning!</b> ReHLDS is not compatible with an old 5xxx or below platforms downloaded by hldsupdatetool.
29+
> [!CAUTION]
30+
> ReHLDS is not compatible with an old 5xxx or below platforms downloaded by hldsupdatetool.
2131
2232
#### Downloading HLDS via steamcmd
2333

0 commit comments

Comments
 (0)