[ci] updates

+ added signing
+ migrated to windows-2025 runner
+ wmic deprecated and migrated to ps
+ runners update

+ intel compiller -> gcc
This commit is contained in:
STAM 2025-07-16 18:47:24 +03:00
parent a41d090cd5
commit 7877d9d097
No known key found for this signature in database
GPG Key ID: 711526C6938897F1
3 changed files with 208 additions and 22 deletions

View File

@ -5,16 +5,18 @@ on:
branches: [master] branches: [master]
paths-ignore: paths-ignore:
- '**.md' - '**.md'
- '.github/**'
pull_request: pull_request:
types: [opened, reopened, synchronize] types: [opened, reopened, synchronize]
release: release:
types: [published] types: [published]
workflow_dispatch:
jobs: jobs:
windows: windows:
name: 'Windows' name: 'Windows'
runs-on: windows-2019 runs-on: windows-2025
env: env:
solution: 'msvc/resemiclip.sln' solution: 'msvc/resemiclip.sln'
@ -23,34 +25,118 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup MSBuild - name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.1.3 uses: microsoft/setup-msbuild@v2
with:
vs-version: '16.8' # TODO: add support of 141_xp toolchain at VS2022+
# - name: Install v140, v141 and v142 toolsets
# shell: cmd
# run: |
# "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" modify ^
# --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" ^
# --add Microsoft.VisualStudio.Component.WindowsXP ^
# --add Microsoft.VisualStudio.Component.VC.v140 ^
# --add Microsoft.VisualStudio.Component.VC.v140.x86.x64 ^
# --add Microsoft.VisualStudio.Component.VC.v140.xp ^
# --add Microsoft.VisualStudio.Component.VC.140.CRT ^
# --add Microsoft.VisualStudio.Component.VC.v141 ^
# --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 ^
# --add Microsoft.VisualStudio.Component.VC.v141.xp ^
# --add Microsoft.VisualStudio.Component.VC.v142 ^
# --add Microsoft.VisualStudio.Component.VC.v142.x86.x64 ^
# --quiet --norestart
- name: Select PlatformToolset
id: select_toolset
shell: pwsh
run: |
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vs2019 = & $vswhere -products * -version "[16.0,17.0)" -property installationPath -latest
$vs2022 = & $vswhere -products * -version "[17.0,)" -property installationPath -latest
if ($vs2019) {
"toolset=v140_xp" >> $env:GITHUB_OUTPUT
Write-Host "Selected v140_xp toolset"
} elseif ($vs2022) {
"toolset=v143" >> $env:GITHUB_OUTPUT
Write-Host "Selected v143 toolset"
} else {
Write-Error "No suitable Visual Studio installation found"
exit 1
}
- name: Build - name: Build
run: | run: |
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildRelease }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false $toolset = '${{ steps.select_toolset.outputs.toolset }}'
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildRelease }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=$toolset /p:XPDeprecationWarning=false
- name: Copy Binary files - name: Copy Binary files
run: | run: |
mkdir publish\addons\resemiclip mkdir publish\addons\resemiclip
move msvc\${{ env.buildRelease }}\resemiclip_mm.dll publish\addons\resemiclip\resemiclip_mm.dll move msvc\${{ env.buildRelease }}\resemiclip_mm.dll publish\addons\resemiclip\resemiclip_mm.dll
- name: Get app version
id: get_version
shell: pwsh
run: |
$versionFile = "version/appversion.h"
if (-not (Test-Path $versionFile)) {
Write-Error "Version file not found: $versionFile"
exit 1
}
$content = Get-Content $versionFile
foreach ($line in $content) {
if ($line -match '^\s*#define\s+APP_VERSION\s+"([^"]+)"') {
$version = $matches[1]
"version=$version" >> $env:GITHUB_OUTPUT
Write-Host "Found version: $version"
exit 0
}
}
Write-Error "APP_VERSION not found in file"
exit 1
- name: Show version
run: echo "Version is ${{ steps.get_version.outputs.version }}"
- name: Get rcedit from chocolatey
shell: pwsh
run: |
choco install rcedit -y
- name: Edit resources at windows binaries
run: |
rcedit ${{ github.workspace }}\publish\addons\resemiclip\resemiclip_mm.dll --set-version-string ProductName "ReSemiclip - resemiclip_mm.dll" --set-file-version "${{ steps.get_version.outputs.version }}" --set-product-version "${{ steps.get_version.outputs.version }}" --set-version-string FileDescription "ReSemiclip - This module allows to pass through players, 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 msvc/icon.ico
shell: "pwsh"
- name: Import PFX and sign
if: github.event_name != 'pull_request'
env:
KEY_PFX_PASS: ${{ secrets.KEY_PFX_PASS }}
# https://github.com/actions/runner-images/blob/main/images/windows/Windows2025-Readme.md
run: |
$pfxBase64 = "${{ secrets.KEY_PFX_B64 }}"
[IO.File]::WriteAllBytes("${{ github.workspace }}\signing-cert.pfx", [Convert]::FromBase64String($pfxBase64))
certutil -f -p "${{ secrets.KEY_PFX_PASS }}" -importPFX "${{ github.workspace }}\signing-cert.pfx"
& '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 "ReSemiclip - resemiclip_mm.dll" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha256 /fd sha256 /v ${{ github.workspace }}\publish\addons\resemiclip\resemiclip_mm.dll
Remove-Item -Recurse -Force "${{ github.workspace }}\signing-cert.pfx"
shell: "pwsh"
- name: Deploy artifacts - name: Deploy artifacts
uses: actions/upload-artifact@v3.1.1 uses: actions/upload-artifact@v4
with: with:
name: win32 name: win32
path: publish/* path: publish/*
linux: linux:
name: 'Linux' name: 'Linux'
runs-on: ubuntu-latest runs-on: ubuntu-24.04
container: s1lentq/linux86buildtools:latest container: debian:11-slim
outputs: outputs:
app-version: ${{ steps.app-version.outputs.version }} app-version: ${{ steps.app-version.outputs.version }}
@ -58,14 +144,71 @@ jobs:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps: steps:
- name: Install dependencies
run: |
dpkg --add-architecture i386
apt-get update
apt-get install -y \
gcc-multilib g++-multilib \
build-essential \
libc6-dev libc6-dev-i386 \
git cmake rsync \
g++ gcc
- name: Configure
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Build using Intel C++ Compiler 19.0 - name: GPG Import
run: | run: |
rm -rf build && CC=icc CXX=icpc cmake -B build && cmake --build build -j8 echo "${{ secrets.PUB_ASC }}" > "${{ secrets.PUB_ASC_FILE }}"
echo "${{ secrets.KEY_ASC }}" > "${{ secrets.KEY_ASC_FILE }}"
# Import the public key
gpg --batch --yes --import "${{ secrets.PUB_ASC_FILE }}"
if [[ $? -ne 0 ]]; then
echo "Error: Failed to import the public key"
exit 1
fi
# Import the private key
gpg --batch --yes --import "${{ secrets.KEY_ASC_FILE }}"
if [[ $? -ne 0 ]]; then
echo "Error: Failed to import the private key"
exit 2
fi
# Extract the fingerprint of the imported public key
GPG_LINUX_FINGERPRINT=$(gpg --list-keys --with-colons | grep '^fpr' | head -n 1 | cut -d: -f10)
# Check if the fingerprint was extracted
if [[ -z "$GPG_LINUX_FINGERPRINT" ]]; then
echo "Error: Failed to extract the fingerprint of the key"
exit 3
fi
# Set the trust level for the key
echo "$GPG_LINUX_FINGERPRINT:6:" | gpg --batch --import-ownertrust
if [ $? -ne 0 ]; then
echo "Error: Failed to set trust for the key $GPG_LINUX_FINGERPRINT"
exit 4
fi
echo "Key $GPG_LINUX_FINGERPRINT successfully imported and trusted"
gpg --list-keys
#export for global use
echo "GPG_LINUX_FINGERPRINT=$GPG_LINUX_FINGERPRINT" >> $GITHUB_ENV
shell: bash
if: github.event_name != 'pull_request'
- name: Build using GCC Compiler
run: |
rm -rf build && CC=gcc CXX=g++ cmake -B build && cmake --build build -j8
- name: Reading appversion.h - name: Reading appversion.h
id: app-version id: app-version
@ -77,6 +220,7 @@ jobs:
else else
# Remove quotes # Remove quotes
APP_VERSION=$(echo $APP_VERSION | xargs) APP_VERSION=$(echo $APP_VERSION | xargs)
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
fi fi
fi fi
echo "version=${APP_VERSION}" >> "$GITHUB_OUTPUT" echo "version=${APP_VERSION}" >> "$GITHUB_OUTPUT"
@ -92,7 +236,7 @@ jobs:
mv build/resemiclip_mm_i386.so publish/addons/resemiclip/resemiclip_mm_i386.so mv build/resemiclip_mm_i386.so publish/addons/resemiclip/resemiclip_mm_i386.so
- name: Deploy artifacts - name: Deploy artifacts
uses: actions/upload-artifact@v3.1.1 uses: actions/upload-artifact@v4
id: upload-job id: upload-job
with: with:
name: linux32 name: linux32
@ -105,12 +249,12 @@ jobs:
steps: steps:
- name: Deploying linux artifacts - name: Deploying linux artifacts
uses: actions/download-artifact@v3 uses: actions/download-artifact@v4
with: with:
name: linux32 name: linux32
- name: Deploying windows artifacts - name: Deploying windows artifacts
uses: actions/download-artifact@v3 uses: actions/download-artifact@v4
with: with:
name: win32 name: win32
@ -121,7 +265,29 @@ jobs:
github.event.action == 'published' && github.event.action == 'published' &&
startsWith(github.ref, 'refs/tags/') startsWith(github.ref, 'refs/tags/')
run: | run: |
# new runner, niw signs
echo "${{ secrets.PUB_ASC }}" > "${{ secrets.PUB_ASC_FILE }}"
echo "${{ secrets.KEY_ASC }}" > "${{ secrets.KEY_ASC_FILE }}"
gpg --batch --yes --import "${{ secrets.PUB_ASC_FILE }}"
gpg --batch --yes --import "${{ secrets.KEY_ASC_FILE }}"
GPG_LINUX_FINGERPRINT=$(gpg --list-keys --with-colons | grep '^fpr' | head -n 1 | cut -d: -f10)
echo "$GPG_LINUX_FINGERPRINT:6:" | gpg --batch --import-ownertrust
echo "GPG_LINUX_FINGERPRINT=$GPG_LINUX_FINGERPRINT" >> $GITHUB_ENV
sign_file() {
local file=$1
gpg --batch --yes --detach-sign --armor -u "$GPG_LINUX_FINGERPRINT" "$file"
if [ $? -ne 0 ]; then
echo "Error: Failed to sign $file"
exit 2
fi
echo "$file signed successfully."
}
# Pack and sign final archive
7z a -tzip resemiclip-${{ needs.linux.outputs.app-version }}.zip addons/ 7z a -tzip resemiclip-${{ needs.linux.outputs.app-version }}.zip addons/
sign_file "resemiclip-${{ env.APP_VERSION }}.zip"
- name: Publish artifacts - name: Publish artifacts
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
@ -132,5 +298,7 @@ jobs:
with: with:
files: | files: |
*.zip *.zip
*.7z
*.asc
env: env:
GITHUB_TOKEN: ${{ secrets.API_TOKEN }} GITHUB_TOKEN: ${{ secrets.API_TOKEN }}

View File

@ -17,14 +17,32 @@ set commitURL=
set commitCount=0 set commitCount=0
set branch_name=master set branch_name=master
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set "dt=%%a" for /f "tokens=*" %%i in ('powershell -NoProfile -Command ^
set "YYYY=%dt:~0,4%" "$now = Get-Date; Write-Output ('{0:yyyy}|{0:MM}|{0:dd}|{0:HH}|{0:mm}|{0:ss}' -f $now)"') do (
set "MM=%dt:~4,2%" for /f "tokens=1-6 delims=|" %%a in ("%%i") do (
set "DD=%dt:~6,2%" set "YYYY=%%a"
set "hour=%dt:~8,2%" set "MM=%%b"
set "min=%dt:~10,2%" set "DD=%%c"
set "sec=%dt:~12,2%" set "hour=%%d"
set "min=%%e"
set "sec=%%f"
)
)
echo YYYY=%YYYY%
echo MM=%MM%
echo DD=%DD%
echo hour=%hour%
echo min=%min%
echo sec=%sec%
:: for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set "dt=%%a"
:: set "YYYY=%dt:~0,4%"
:: set "MM=%dt:~4,2%"
:: set "DD=%dt:~6,2%"
:: set "hour=%dt:~8,2%"
:: set "min=%dt:~10,2%"
:: set "sec=%dt:~12,2%"
:: ::
:: Remove leading zero from MM (e.g 09 > 9) :: Remove leading zero from MM (e.g 09 > 9)
for /f "tokens=* delims=0" %%I in ("%MM%") do set MM=%%I for /f "tokens=* delims=0" %%I in ("%MM%") do set MM=%%I

BIN
msvc/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB