From a031b97ef832c9ca0ea4ef47c70d2a6b4cbb9c94 Mon Sep 17 00:00:00 2001 From: Fabio Rossini Sluzala Date: Mon, 13 Apr 2026 13:39:15 -0300 Subject: [PATCH 01/11] ci: add GitHub Actions workflow for building and releasing the project --- .github/workflows/build.yml | 149 ++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..f9026b8b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,149 @@ +name: Build + +on: + push: + branches: ["**"] + tags: ["v*.*.*"] + pull_request: + workflow_dispatch: + +jobs: + build: + runs-on: windows-2022 + + strategy: + fail-fast: false + matrix: + configuration: [Release, Debug] + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + # ------------------------------------------------------------------- + # Instala o toolset v141 (VS 2017) + suporte a XP no VS 2022 presente + # no runner. O componente WinXP habilita o v141_xp usado pelo premake. + # ------------------------------------------------------------------- + - name: Install v141_xp toolset + shell: cmd + run: | + "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\setup.exe" modify ^ + --passive --norestart ^ + --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" ^ + --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 ^ + --add Microsoft.VisualStudio.Component.WinXP + # Timeout ocasional é esperado; o step falha limpo se o installer + # retornar código != 0, o que torna o problema visível nos logs. + + # ------------------------------------------------------------------- + # Gera os projetos VS2015 via Premake (o .exe já está no repo). + # O premake define PlatformToolset=v140_xp nos .vcxproj; vamos + # sobrescrever isso no MSBuild mais abaixo — sem tocar no premake5.lua. + # ------------------------------------------------------------------- + - name: Generate project files (vs2015) + shell: cmd + run: premake5.exe vs2015 --outdir=build_temp + + # ------------------------------------------------------------------- + # Configura o ambiente MSVC para o toolset 14.16 (VS 2017 / v141). + # Necessário para que o msbuild encontre o compilador correto. + # ------------------------------------------------------------------- + - name: Setup MSVC environment (v141) + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x86 + toolset: 14.16 # toolset do VS 2017 + + # ------------------------------------------------------------------- + # Compila sobrescrevendo o PlatformToolset para v141_xp. + # + # Por que funciona sem mexer nos .vcxproj: + # O MSBuild permite que qualquer propriedade definida em /p: na linha + # de comando tenha precedência sobre o valor do arquivo de projeto. + # "v141_xp" é exatamente o mesmo toolset que você confirmou funcionar + # ao alterar manualmente pelo Visual Studio 2017. + # + # /m → paralelismo (usa todos os núcleos do runner). + # /v:m → verbosidade minimal para logs legíveis. + # ------------------------------------------------------------------- + - name: Build (${{ matrix.configuration }}) + shell: cmd + run: | + msbuild build_temp\modloader.sln ^ + /p:Configuration=${{ matrix.configuration }} ^ + /p:Platform=Win32 ^ + /p:PlatformToolset=v141_xp ^ + /m /v:m + + # ------------------------------------------------------------------- + # Coleta os binários gerados. + # Estrutura de saída do premake: bin/ (modloader.asi) e + # bin/plugins/gta3/*.dll para os plugins. + # ------------------------------------------------------------------- + - name: Collect artifacts + shell: pwsh + run: | + $cfg = "${{ matrix.configuration }}" + $dest = "artifacts\modloader-$cfg" + + # ASI principal + New-Item -ItemType Directory -Force -Path "$dest" | Out-Null + Copy-Item "bin\modloader.asi" "$dest\" -ErrorAction SilentlyContinue + + # Plugins gta3 + $pluginSrc = "bin\plugins\gta3" + if (Test-Path $pluginSrc) { + New-Item -ItemType Directory -Force -Path "$dest\plugins\gta3" | Out-Null + Copy-Item "$pluginSrc\*.dll" "$dest\plugins\gta3\" -ErrorAction SilentlyContinue + } + + # PDBs (ficam junto aos binários no mesmo diretório) + Copy-Item "bin\*.pdb" "$dest\" -ErrorAction SilentlyContinue + Copy-Item "bin\plugins\gta3\*.pdb" "$dest\plugins\gta3\" -ErrorAction SilentlyContinue + + # Docs / configs de exemplo + Copy-Item "doc\config\*.ini.0" "$dest\" -ErrorAction SilentlyContinue + Copy-Item "doc\CHANGELOG.md" "$dest\" -ErrorAction SilentlyContinue + Copy-Item "LICENSE" "$dest\" -ErrorAction SilentlyContinue + + Write-Host "=== Artifacts ===" + Get-ChildItem -Recurse $dest | Select-Object FullName + + - name: Upload artifact – ${{ matrix.configuration }} + uses: actions/upload-artifact@v4 + with: + name: modloader-${{ matrix.configuration }}-${{ github.sha }} + path: artifacts\modloader-${{ matrix.configuration }}\ + if-no-files-found: error + retention-days: 30 + + # ----------------------------------------------------------------------- + # Job extra: cria uma Release no GitHub quando uma tag "v*.*.*" é enviada. + # Só roda se o job build (Release) passou. + # ----------------------------------------------------------------------- + release: + if: startsWith(github.ref, 'refs/tags/v') + needs: build + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Download Release artifact + uses: actions/download-artifact@v4 + with: + name: modloader-Release-${{ github.sha }} + path: dist/ + + - name: Zip release + run: | + cd dist + zip -r ../modloader-${{ github.ref_name }}.zip . + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: modloader-${{ github.ref_name }}.zip + generate_release_notes: true From d41315d67c0ccb3254b52516beda5c892f452098 Mon Sep 17 00:00:00 2001 From: Fabio Rossini Sluzala Date: Mon, 20 Apr 2026 13:06:11 -0300 Subject: [PATCH 02/11] ci(build.yml): update comments for clarity and consistency ci(build.yml): add detailed comments explaining each step in the build process ci(build.yml): correct comment about MSBuild property precedence and toolset version ci(build.yml): update artifact collection comments to reflect current directory structure ci(build.yml): add comments explaining the purpose of the release job --- .github/workflows/build.yml | 49 +++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f9026b8b..79d66374 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,8 +23,8 @@ jobs: submodules: recursive # ------------------------------------------------------------------- - # Instala o toolset v141 (VS 2017) + suporte a XP no VS 2022 presente - # no runner. O componente WinXP habilita o v141_xp usado pelo premake. + # Install v141 (VS 2017) toolset and WinXP support on the runner. + # The WinXP component provides the v141_xp toolset required by premake. # ------------------------------------------------------------------- - name: Install v141_xp toolset shell: cmd @@ -38,17 +38,18 @@ jobs: # retornar código != 0, o que torna o problema visível nos logs. # ------------------------------------------------------------------- - # Gera os projetos VS2015 via Premake (o .exe já está no repo). - # O premake define PlatformToolset=v140_xp nos .vcxproj; vamos - # sobrescrever isso no MSBuild mais abaixo — sem tocar no premake5.lua. + # Generate VS2015 project files using Premake (premake5.exe included + # in the repository). + # Premake sets PlatformToolset=v140_xp in the .vcxproj files; this is + # overridden when invoking MSBuild below without modifying premake5.lua. # ------------------------------------------------------------------- - name: Generate project files (vs2015) shell: cmd run: premake5.exe vs2015 --outdir=build_temp # ------------------------------------------------------------------- - # Configura o ambiente MSVC para o toolset 14.16 (VS 2017 / v141). - # Necessário para que o msbuild encontre o compilador correto. + # Configure MSVC environment for toolset 14.16 (VS 2017 / v141). + # Required so msbuild can locate the correct compiler and toolset. # ------------------------------------------------------------------- - name: Setup MSVC environment (v141) uses: ilammy/msvc-dev-cmd@v1 @@ -57,16 +58,12 @@ jobs: toolset: 14.16 # toolset do VS 2017 # ------------------------------------------------------------------- - # Compila sobrescrevendo o PlatformToolset para v141_xp. - # - # Por que funciona sem mexer nos .vcxproj: - # O MSBuild permite que qualquer propriedade definida em /p: na linha - # de comando tenha precedência sobre o valor do arquivo de projeto. - # "v141_xp" é exatamente o mesmo toolset que você confirmou funcionar - # ao alterar manualmente pelo Visual Studio 2017. - # - # /m → paralelismo (usa todos os núcleos do runner). - # /v:m → verbosidade minimal para logs legíveis. + # Build and override PlatformToolset to v141_xp via MSBuild. + # MSBuild command-line properties passed with /p: take precedence over + # project file values. v141_xp is the v141 toolset variant that provides + # WinXP support. + # /m -> enable parallel build using all available cores. + # /v:m -> minimal verbosity for concise logs. # ------------------------------------------------------------------- - name: Build (${{ matrix.configuration }}) shell: cmd @@ -78,9 +75,9 @@ jobs: /m /v:m # ------------------------------------------------------------------- - # Coleta os binários gerados. - # Estrutura de saída do premake: bin/ (modloader.asi) e - # bin/plugins/gta3/*.dll para os plugins. + # Collect generated binaries. + # Premake output layout: bin/ (modloader.asi) and + # bin/plugins/gta3/*.dll for plugins. # ------------------------------------------------------------------- - name: Collect artifacts shell: pwsh @@ -88,22 +85,22 @@ jobs: $cfg = "${{ matrix.configuration }}" $dest = "artifacts\modloader-$cfg" - # ASI principal + # Main ASI binary New-Item -ItemType Directory -Force -Path "$dest" | Out-Null Copy-Item "bin\modloader.asi" "$dest\" -ErrorAction SilentlyContinue - # Plugins gta3 + # GTA3 plugins $pluginSrc = "bin\plugins\gta3" if (Test-Path $pluginSrc) { New-Item -ItemType Directory -Force -Path "$dest\plugins\gta3" | Out-Null Copy-Item "$pluginSrc\*.dll" "$dest\plugins\gta3\" -ErrorAction SilentlyContinue } - # PDBs (ficam junto aos binários no mesmo diretório) + # PDB files (placed with binaries in the same directory) Copy-Item "bin\*.pdb" "$dest\" -ErrorAction SilentlyContinue Copy-Item "bin\plugins\gta3\*.pdb" "$dest\plugins\gta3\" -ErrorAction SilentlyContinue - # Docs / configs de exemplo + # Example docs and configuration files Copy-Item "doc\config\*.ini.0" "$dest\" -ErrorAction SilentlyContinue Copy-Item "doc\CHANGELOG.md" "$dest\" -ErrorAction SilentlyContinue Copy-Item "LICENSE" "$dest\" -ErrorAction SilentlyContinue @@ -120,8 +117,8 @@ jobs: retention-days: 30 # ----------------------------------------------------------------------- - # Job extra: cria uma Release no GitHub quando uma tag "v*.*.*" é enviada. - # Só roda se o job build (Release) passou. + # Extra job: create a GitHub Release when a tag matching v*.*.* is pushed. + # Runs only if the build (Release) job completed successfully. # ----------------------------------------------------------------------- release: if: startsWith(github.ref, 'refs/tags/v') From 834992252c1720d7c3a6d19fc826d9bd762a0e24 Mon Sep 17 00:00:00 2001 From: Denilson Amorim Date: Sat, 16 May 2026 15:12:29 -0300 Subject: [PATCH 03/11] chore: update release.lua to support PDB packaging --- release.bat | 5 ++- release.lua | 105 +++++++++++++++++++++++++++++++--------------------- 2 files changed, 65 insertions(+), 45 deletions(-) diff --git a/release.bat b/release.bat index 9c345190..1cf09fa0 100644 --- a/release.bat +++ b/release.bat @@ -1,5 +1,6 @@ @echo off set CL=/MP -premake5 --file=release.lua prepare --toolset=vs2015 +set "PATH=%ProgramFiles(x86)%\Windows Kits\10\Debuggers\x86;%PATH%" +premake5 --file=release.lua prepare --toolset=vs2022 pause -goto:eof +goto:eof \ No newline at end of file diff --git a/release.lua b/release.lua index bf9849e0..9aa37b38 100644 --- a/release.lua +++ b/release.lua @@ -10,23 +10,12 @@ newaction { execute = function() main() end } -newoption { - trigger = "debug-symbols", - description = "Makes a release which contains public debug symbols, which allows better user debugging", -} - newoption { trigger = "toolset", value = "tools", - description = "The toolset used to compile the release build", - allowed = { - { "vs2013", "Microsoft Visual Studio 2013" }, - { "vs2015", "Microsoft Visual Studio 2015" }, - { "gcc", "GNU Compiler Collection" } - } + description = "The toolset used to compile the release build (vs20xx or gcc)", } - toolset = _OPTIONS["toolset"] action = (toolset == "gcc" and "gmake" or toolset) compiler = (toolset == "gcc" and "gcc" or "cl") @@ -34,26 +23,31 @@ build = (toolset == "gcc" and "make" or "msbuild") function main() - local debugsymbols = _OPTIONS["debug-symbols"] - if not toolset then print("No toolset defined.\nAborting.") exit() end + if toolset ~= "gcc" and not toolset:match("^vs") then + print("Unsupported toolset '" .. toolset .. "' (use a vs* premake action or gcc).\nAborting.") + exit() + end + + require_tools() + local install = function() print "Making release directory tree..." - execute("premake5 install ./release/") - os.copyfile("./release/modloader/.data/Readme.md", "./release/Readme.txt") - os.copyfile("./release/modloader/.data/Leia-me.md", "./release/Leia-me.txt") - os.mkdir("./release/modloader/.profiles") + execute("premake5 install ./release/binaries/") + os.copyfile("./release/binaries/modloader/.data/Readme.md", "./release/binaries/Readme.txt") + os.copyfile("./release/binaries/modloader/.data/Leia-me.md", "./release/binaries/Leia-me.txt") + os.mkdir("./release/binaries/modloader/.profiles") end print "Cleaning workspace..." execute("premake5 clean") print "Generating build files..." - if toolset == "gmake" then + if toolset == "gcc" then execute(string.format("premake5 %s --cc=%s --outdir=build_temp", action, compiler)) else execute(string.format("premake5 %s --outdir=build_temp", action)) @@ -61,16 +55,13 @@ function main() print "Building..." if build == "msbuild" then - + -- also use 'set CL=/MP' at release.bat execute("msbuild build_temp/modloader.sln /p:configuration=Release /p:platform=Win32 /m") - -- Install THEN move pdbs install() - if debugsymbols then - pdbmove() - end - + pdbpackage() + elseif compiler == "gcc" then local cwd = os.getcwd() @@ -81,9 +72,9 @@ function main() -- Strip binaries (ALWAYS) gccstrip() -- striping is not related to symbols, to have symbols send --export-all-symbols to the linker - + install() - + else print("Internal error") exit() @@ -92,22 +83,21 @@ function main() os.rmdir("build_temp") end +function pdbpackage() + print("Packaging stripped debug symbols (release/symbols/)...") + os.mkdir("release/symbols") + os.mkdir("release/symbols/modloader/.data/plugins/gta3") + execute('pdbcopy "bin/modloader.pdb" "release/symbols/modloader.pdb" -p') -function pdbmove() - print("Moving PDB files into release...") - pdbcopy("bin", "release", false) - pdbcopy("bin/plugins", "release/modloader/.data/plugins", true) -end - -function pdbcopy(src, dest, recursive) - local cwd = os.getcwd() - os.chdir(src) - for i, file in ipairs(os.matchfiles(recursive and "**.pdb" or "*.pdb")) do - execute(string.format([[pdbcopy "%s" "%s" -p]], file, cwd .. '/' .. dest .. '/' .. file)) + for i, file in ipairs(os.matchfiles("bin/plugins/gta3/*.pdb")) do + local name = path.getname(file) + execute(string.format( + 'pdbcopy "bin/plugins/gta3/%s" "release/symbols/modloader/.data/plugins/gta3/%s" -p', + name, name + )) end - os.chdir(cwd) end function gccstrip() @@ -124,16 +114,45 @@ function gccstrip() os.chdir(cwd) end +function require_tools() + require_on_path("premake5", + "Install Premake 5 and add it to PATH.") + if build == "msbuild" then + require_on_path("msbuild", + "Install Visual Studio with MSBuild, then run this from the x86 Native Tools Command Prompt.") + require_on_path("pdbcopy", + "Install the Debugging Tools for Windows component from the Windows SDK," .. + " then add %ProgramFiles(x86)%\\Windows Kits\\10\\Debuggers\\x86 to PATH.") + elseif compiler == "gcc" then + require_on_path("mingw32-make", + "Install MinGW and add mingw32-make to PATH.") + end +end - +function require_on_path(name, hint) + if not os.ishost("windows") then + return + end + local found = os.outputof("where " .. name .. " 2>nul") + if not found or found == "" then + print("Error: " .. name .. " is not on PATH.") + if hint then + print(hint) + end + exit() + end +end function execute(command) - os.execute(command) + local result = os.execute(command) + if result == 0 or result == true then + return + end + print("Command failed: " .. command .. "\nAborting.") + exit() end function exit() os.exit() end - - From d6013f806f31125d15ec0a10e7b62d24931e0825 Mon Sep 17 00:00:00 2001 From: Denilson Amorim Date: Sat, 16 May 2026 19:57:40 -0300 Subject: [PATCH 04/11] chore: improve build.yml --- .github/workflows/build.yml | 175 +++++++++++++----------------------- 1 file changed, 64 insertions(+), 111 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 79d66374..544b5aec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,124 +2,56 @@ name: Build on: push: - branches: ["**"] - tags: ["v*.*.*"] + branches: [master, develop] + tags: ["v*.*.*"] + paths-ignore: ["**/*.md", "doc/**"] pull_request: + paths-ignore: ["**/*.md", "doc/**"] workflow_dispatch: +permissions: + contents: read + jobs: build: - runs-on: windows-2022 - - strategy: - fail-fast: false - matrix: - configuration: [Release, Debug] + runs-on: windows-latest steps: - - name: Checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 with: submodules: recursive - # ------------------------------------------------------------------- - # Install v141 (VS 2017) toolset and WinXP support on the runner. - # The WinXP component provides the v141_xp toolset required by premake. - # ------------------------------------------------------------------- + - name: Install premake5 + run: winget install -e --id Premake.Premake.5.Beta --accept-source-agreements --accept-package-agreements + - name: Install v141_xp toolset - shell: cmd run: | - "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\setup.exe" modify ^ - --passive --norestart ^ - --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" ^ - --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 ^ + $vsinstaller = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer" + $vspath = & "$vsinstaller\vswhere.exe" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath + if (-not $vspath) { throw "Visual Studio installation not found" } + & "$vsinstaller\setup.exe" modify --passive --norestart --installPath "$vspath" ` + --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 ` --add Microsoft.VisualStudio.Component.WinXP - # Timeout ocasional é esperado; o step falha limpo se o installer - # retornar código != 0, o que torna o problema visível nos logs. - - # ------------------------------------------------------------------- - # Generate VS2015 project files using Premake (premake5.exe included - # in the repository). - # Premake sets PlatformToolset=v140_xp in the .vcxproj files; this is - # overridden when invoking MSBuild below without modifying premake5.lua. - # ------------------------------------------------------------------- - - name: Generate project files (vs2015) - shell: cmd - run: premake5.exe vs2015 --outdir=build_temp - - # ------------------------------------------------------------------- - # Configure MSVC environment for toolset 14.16 (VS 2017 / v141). - # Required so msbuild can locate the correct compiler and toolset. - # ------------------------------------------------------------------- - - name: Setup MSVC environment (v141) - uses: ilammy/msvc-dev-cmd@v1 - with: - arch: x86 - toolset: 14.16 # toolset do VS 2017 - - # ------------------------------------------------------------------- - # Build and override PlatformToolset to v141_xp via MSBuild. - # MSBuild command-line properties passed with /p: take precedence over - # project file values. v141_xp is the v141 toolset variant that provides - # WinXP support. - # /m -> enable parallel build using all available cores. - # /v:m -> minimal verbosity for concise logs. - # ------------------------------------------------------------------- - - name: Build (${{ matrix.configuration }}) - shell: cmd - run: | - msbuild build_temp\modloader.sln ^ - /p:Configuration=${{ matrix.configuration }} ^ - /p:Platform=Win32 ^ - /p:PlatformToolset=v141_xp ^ - /m /v:m - - # ------------------------------------------------------------------- - # Collect generated binaries. - # Premake output layout: bin/ (modloader.asi) and - # bin/plugins/gta3/*.dll for plugins. - # ------------------------------------------------------------------- - - name: Collect artifacts - shell: pwsh - run: | - $cfg = "${{ matrix.configuration }}" - $dest = "artifacts\modloader-$cfg" - - # Main ASI binary - New-Item -ItemType Directory -Force -Path "$dest" | Out-Null - Copy-Item "bin\modloader.asi" "$dest\" -ErrorAction SilentlyContinue - - # GTA3 plugins - $pluginSrc = "bin\plugins\gta3" - if (Test-Path $pluginSrc) { - New-Item -ItemType Directory -Force -Path "$dest\plugins\gta3" | Out-Null - Copy-Item "$pluginSrc\*.dll" "$dest\plugins\gta3\" -ErrorAction SilentlyContinue - } - - # PDB files (placed with binaries in the same directory) - Copy-Item "bin\*.pdb" "$dest\" -ErrorAction SilentlyContinue - Copy-Item "bin\plugins\gta3\*.pdb" "$dest\plugins\gta3\" -ErrorAction SilentlyContinue - - # Example docs and configuration files - Copy-Item "doc\config\*.ini.0" "$dest\" -ErrorAction SilentlyContinue - Copy-Item "doc\CHANGELOG.md" "$dest\" -ErrorAction SilentlyContinue - Copy-Item "LICENSE" "$dest\" -ErrorAction SilentlyContinue - - Write-Host "=== Artifacts ===" - Get-ChildItem -Recurse $dest | Select-Object FullName - - - name: Upload artifact – ${{ matrix.configuration }} - uses: actions/upload-artifact@v4 + + - uses: microsoft/setup-msbuild@v2 + + - name: Add pdbcopy to PATH + run: echo "${env:ProgramFiles(x86)}\Windows Kits\10\Debuggers\x86" >> $env:GITHUB_PATH + + - name: Build + env: + CL: /MP + run: premake5 --file=release.lua prepare --toolset=vs2022 + + - uses: actions/upload-artifact@v4 with: - name: modloader-${{ matrix.configuration }}-${{ github.sha }} - path: artifacts\modloader-${{ matrix.configuration }}\ + name: modloader-${{ github.sha }} + path: | + release/binaries + release/symbols if-no-files-found: error retention-days: 30 - # ----------------------------------------------------------------------- - # Extra job: create a GitHub Release when a tag matching v*.*.* is pushed. - # Runs only if the build (Release) job completed successfully. - # ----------------------------------------------------------------------- release: if: startsWith(github.ref, 'refs/tags/v') needs: build @@ -128,19 +60,40 @@ jobs: contents: write steps: - - name: Download Release artifact - uses: actions/download-artifact@v4 + - uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 with: - name: modloader-Release-${{ github.sha }} + name: modloader-${{ github.sha }} path: dist/ - - name: Zip release + - name: Package zip files run: | - cd dist - zip -r ../modloader-${{ github.ref_name }}.zip . + cd dist/release + (cd binaries && zip -r ../../modloader.zip .) + (cd symbols && zip -r ../../pdb-symbols.zip .) - - name: Create GitHub Release - uses: softprops/action-gh-release@v2 + - name: Prepare release notes + env: + TAG: ${{ github.ref_name }} + run: | + python3 <<'PY' + import os, re, sys + tag = os.environ["TAG"] + lines = open("doc/CHANGELOG.md").readlines() + i = next((i for i, l in enumerate(lines) if l.startswith(tag + " ")), None) + if i is None: + sys.exit(f"No changelog for {tag} in CHANGELOG.md") + j = next((j for j in range(i + 1, len(lines)) if re.match(r"^v\d+\.\d+", lines[j])), len(lines)) + open("release-body.md", "w").writelines(lines[i:j]) + PY + + - uses: softprops/action-gh-release@v2 with: - files: modloader-${{ github.ref_name }}.zip - generate_release_notes: true + tag_name: ${{ github.ref_name }} + name: Mod Loader ${{ github.ref_name }} + body_path: release-body.md + files: | + dist/modloader.zip + dist/pdb-symbols.zip + fail_on_unmatched_files: true From 3b766bdb74215c930ac653b3ff74692c29133c6e Mon Sep 17 00:00:00 2001 From: Denilson Amorim Date: Sat, 16 May 2026 20:10:59 -0300 Subject: [PATCH 05/11] chore: auto detect final release to remove "Development Build" from logs --- .github/workflows/build.yml | 5 ++++- include/modloader/modloader.h | 4 ++-- premake5.lua | 9 +++++++++ release.bat | 11 ++++++++--- release.lua | 10 ++++++++-- 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 544b5aec..b159d67e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,7 +41,10 @@ jobs: - name: Build env: CL: /MP - run: premake5 --file=release.lua prepare --toolset=vs2022 + run: | + $args = @("--file=release.lua", "prepare", "--toolset=vs2022") + if ("${{ github.ref }}" -like "refs/tags/v*") { $args += "--final-release" } + & premake5 @args - uses: actions/upload-artifact@v4 with: diff --git a/include/modloader/modloader.h b/include/modloader/modloader.h index 9a63fc5f..5c34980f 100644 --- a/include/modloader/modloader.h +++ b/include/modloader/modloader.h @@ -30,8 +30,8 @@ extern "C" { #define MODLOADER_VERSION_MAJOR 0 #define MODLOADER_VERSION_MINOR 3 #define MODLOADER_VERSION_REVISION 9 -#ifdef NDEBUG -#define MODLOADER_VERSION_ISDEV 1 +#ifdef MODLOADER_FINAL_RELEASE +#define MODLOADER_VERSION_ISDEV 0 #else #define MODLOADER_VERSION_ISDEV 1 #endif diff --git a/premake5.lua b/premake5.lua index ad102dbe..b0571152 100644 --- a/premake5.lua +++ b/premake5.lua @@ -24,6 +24,11 @@ newoption { description = "Post-build install directory" } +newoption { + trigger = "final-release", + description = "Public release build (defines MODLOADER_FINAL_RELEASE for the whole solution)" +} + newaction { trigger = "clean", description = "Cleans the binary and build files on the directory (bin/, build_temp/)", @@ -204,6 +209,10 @@ solution "modloader" "_SCL_SECURE_NO_WARNINGS" } + if _OPTIONS["final-release"] then + defines { "MODLOADER_FINAL_RELEASE" } + end + includedirs { "include", "deps/cereal/include", diff --git a/release.bat b/release.bat index 1cf09fa0..3a994b31 100644 --- a/release.bat +++ b/release.bat @@ -1,6 +1,11 @@ @echo off +echo Are you sure this is a final release? +echo This will not be tagged in the logs as a development build. +choice /C YN /M "Continue" +if errorlevel 2 exit /b 1 + set CL=/MP set "PATH=%ProgramFiles(x86)%\Windows Kits\10\Debuggers\x86;%PATH%" -premake5 --file=release.lua prepare --toolset=vs2022 -pause -goto:eof \ No newline at end of file +premake5 --file=release.lua prepare --toolset=vs2022 --final-release + +pause \ No newline at end of file diff --git a/release.lua b/release.lua index 9aa37b38..7a0d5b8c 100644 --- a/release.lua +++ b/release.lua @@ -16,7 +16,13 @@ newoption { description = "The toolset used to compile the release build (vs20xx or gcc)", } +newoption { + trigger = "final-release", + description = "Public release build." +} + toolset = _OPTIONS["toolset"] +final_flag = _OPTIONS["final-release"] and " --final-release" or "" action = (toolset == "gcc" and "gmake" or toolset) compiler = (toolset == "gcc" and "gcc" or "cl") build = (toolset == "gcc" and "make" or "msbuild") @@ -48,9 +54,9 @@ function main() print "Generating build files..." if toolset == "gcc" then - execute(string.format("premake5 %s --cc=%s --outdir=build_temp", action, compiler)) + execute(string.format("premake5 %s --cc=%s --outdir=build_temp%s", action, compiler, final_flag)) else - execute(string.format("premake5 %s --outdir=build_temp", action)) + execute(string.format("premake5 %s --outdir=build_temp%s", action, final_flag)) end print "Building..." From fdfe52b6bc96e81ee1c17fcc23e2be304b4b5083 Mon Sep 17 00:00:00 2001 From: Denilson Amorim Date: Sat, 16 May 2026 20:20:29 -0300 Subject: [PATCH 06/11] test1 --- .github/workflows/build.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b159d67e..e1f5d8b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,14 @@ jobs: submodules: recursive - name: Install premake5 - run: winget install -e --id Premake.Premake.5.Beta --accept-source-agreements --accept-package-agreements + run: | + winget install -e --id Premake.Premake.5.Beta --accept-source-agreements --accept-package-agreements --disable-interactivity + $env:Path = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') + ';' + [System.Environment]::GetEnvironmentVariable('Path', 'User') + $premake = Get-Command premake5 -ErrorAction Stop + echo (Split-Path -Parent $premake.Source) >> $env:GITHUB_PATH + + - name: Verify premake5 + run: premake5 --version - name: Install v141_xp toolset run: | @@ -32,6 +39,7 @@ jobs: & "$vsinstaller\setup.exe" modify --passive --norestart --installPath "$vspath" ` --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 ` --add Microsoft.VisualStudio.Component.WinXP + if ($LASTEXITCODE -ne 0) { throw "VS installer modify failed (exit $LASTEXITCODE)" } - uses: microsoft/setup-msbuild@v2 @@ -45,6 +53,7 @@ jobs: $args = @("--file=release.lua", "prepare", "--toolset=vs2022") if ("${{ github.ref }}" -like "refs/tags/v*") { $args += "--final-release" } & premake5 @args + exit $LASTEXITCODE - uses: actions/upload-artifact@v4 with: From 0eed9ff2158d242a23b99700ec78eac7ee74cd04 Mon Sep 17 00:00:00 2001 From: Denilson Amorim Date: Sat, 16 May 2026 20:24:19 -0300 Subject: [PATCH 07/11] test2 --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e1f5d8b9..d8582499 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,14 +32,14 @@ jobs: run: premake5 --version - name: Install v141_xp toolset + shell: cmd run: | - $vsinstaller = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer" - $vspath = & "$vsinstaller\vswhere.exe" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath - if (-not $vspath) { throw "Visual Studio installation not found" } - & "$vsinstaller\setup.exe" modify --passive --norestart --installPath "$vspath" ` - --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 ` + "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\setup.exe" modify ^ + --passive --norestart ^ + --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" ^ + --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 ^ --add Microsoft.VisualStudio.Component.WinXP - if ($LASTEXITCODE -ne 0) { throw "VS installer modify failed (exit $LASTEXITCODE)" } + if errorlevel 1 exit /b 1 - uses: microsoft/setup-msbuild@v2 From 2132440711490347d404ab493e1f54cf944ec039 Mon Sep 17 00:00:00 2001 From: Denilson Amorim Date: Sat, 16 May 2026 20:44:09 -0300 Subject: [PATCH 08/11] test3 --- .github/workflows/build.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d8582499..04bb30c7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,12 +24,8 @@ jobs: - name: Install premake5 run: | winget install -e --id Premake.Premake.5.Beta --accept-source-agreements --accept-package-agreements --disable-interactivity - $env:Path = [System.Environment]::GetEnvironmentVariable('Path', 'Machine') + ';' + [System.Environment]::GetEnvironmentVariable('Path', 'User') - $premake = Get-Command premake5 -ErrorAction Stop - echo (Split-Path -Parent $premake.Source) >> $env:GITHUB_PATH - - - name: Verify premake5 - run: premake5 --version + $env:Path = [System.Environment]::GetEnvironmentVariable('Path','Machine') + ';' + [System.Environment]::GetEnvironmentVariable('Path','User') + echo "$((Get-Command premake5).Path | Split-Path -Parent)" >> $env:GITHUB_PATH - name: Install v141_xp toolset shell: cmd @@ -39,7 +35,6 @@ jobs: --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" ^ --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 ^ --add Microsoft.VisualStudio.Component.WinXP - if errorlevel 1 exit /b 1 - uses: microsoft/setup-msbuild@v2 @@ -50,10 +45,11 @@ jobs: env: CL: /MP run: | - $args = @("--file=release.lua", "prepare", "--toolset=vs2022") - if ("${{ github.ref }}" -like "refs/tags/v*") { $args += "--final-release" } - & premake5 @args - exit $LASTEXITCODE + if ("${{ github.ref }}" -like "refs/tags/v*") { + premake5 --file=release.lua prepare --toolset=vs2022 --final-release + } else { + premake5 --file=release.lua prepare --toolset=vs2022 + } - uses: actions/upload-artifact@v4 with: @@ -61,6 +57,7 @@ jobs: path: | release/binaries release/symbols + include-hidden-files: true if-no-files-found: error retention-days: 30 From 0313a7b48a5281f4e336bf3b5525c9141c5a2f2f Mon Sep 17 00:00:00 2001 From: Denilson Amorim Date: Sat, 16 May 2026 20:44:33 -0300 Subject: [PATCH 09/11] test4 --- doc/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 5e47d569..8ada86fb 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,3 +1,9 @@ +v0.0.0 (Apr 22 1500) +----------------------- + * Test1 something something @thelink2012 + * Test2 something #133 + * Test3 something [a](https://github.com/thelink2012/modloader/pull/133) + v0.3.7 (Jan 20 2018) ----------------------- * Fixed an original game bug causing CdStreamSync to deadlock randomly (included an export for other mods to check if this std.stream build is aware of this bug and fixes it). From b94fd08614b066aecdd42dff5a90d6483dedf833 Mon Sep 17 00:00:00 2001 From: Denilson Amorim Date: Sat, 16 May 2026 21:14:17 -0300 Subject: [PATCH 10/11] fix(ci): include hidden artifact paths and correct release zip layout --- .github/workflows/build.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 04bb30c7..42cb3940 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,9 +54,7 @@ jobs: - uses: actions/upload-artifact@v4 with: name: modloader-${{ github.sha }} - path: | - release/binaries - release/symbols + path: release include-hidden-files: true if-no-files-found: error retention-days: 30 @@ -78,9 +76,8 @@ jobs: - name: Package zip files run: | - cd dist/release - (cd binaries && zip -r ../../modloader.zip .) - (cd symbols && zip -r ../../pdb-symbols.zip .) + (cd dist/binaries && zip -r ../modloader.zip .) + (cd dist/symbols && zip -r ../pdb-symbols.zip .) - name: Prepare release notes env: From bdf1760079f1415858cb52cad2f75fa0674f7f44 Mon Sep 17 00:00:00 2001 From: Denilson Amorim Date: Sat, 16 May 2026 21:38:02 -0300 Subject: [PATCH 11/11] final test --- .github/workflows/build.yml | 1 - doc/CHANGELOG.md | 6 ------ 2 files changed, 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 42cb3940..5fd48ca6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,6 @@ on: push: branches: [master, develop] tags: ["v*.*.*"] - paths-ignore: ["**/*.md", "doc/**"] pull_request: paths-ignore: ["**/*.md", "doc/**"] workflow_dispatch: diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 8ada86fb..5e47d569 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,9 +1,3 @@ -v0.0.0 (Apr 22 1500) ------------------------ - * Test1 something something @thelink2012 - * Test2 something #133 - * Test3 something [a](https://github.com/thelink2012/modloader/pull/133) - v0.3.7 (Jan 20 2018) ----------------------- * Fixed an original game bug causing CdStreamSync to deadlock randomly (included an export for other mods to check if this std.stream build is aware of this bug and fixes it).