From a09eb53b379114fe62d319ecb12ed25e324f56b1 Mon Sep 17 00:00:00 2001 From: ge0rdi Date: Sat, 16 May 2026 08:16:03 +0200 Subject: [PATCH] Add github build workflow --- .github/workflows/build.yml | 54 +++++++++++++++++++++++++++++++++++++ Src/Setup/BuildArchives.bat | 2 ++ 2 files changed, 56 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 000000000..24a5ae216 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,54 @@ +name: Build + +permissions: + contents: read # Default to secure + +on: + pull_request: + branches: + - master + paths: + - 'Src/**' + - 'Localization/**' + - '.github/workflows/build.yml' + + workflow_dispatch: # allows manual trigger for main/master + +jobs: + build: + runs-on: windows-2022 + outputs: + new_version: ${{ steps.versioning.outputs.NEW_VERSION }} + steps: + - name: Checkout code + uses: actions/checkout@v6 + with: + fetch-depth: 0 # Essential to see all tags + + - name: Prepare version + id: versioning + shell: pwsh + run: | + # Fetch latest tag + $latestTag = git describe --tags --abbrev=0 2>$null + + if ($latestTag -notmatch '^v\d+\.\d+\.\d+$') { + Write-Error "Error: Could not find a valid vX.Y.Z tag in history. Found: '$latestTag'" + exit 1 + } + + # Parse and Increment + $version = [version]$latestTag.Substring(1) + $baseVersion = "$($version.Major).$($version.Minor).$($version.Build + 1)" + + # Handle PR Suffix + if ("${{ github.event_name }}" -eq "pull_request") { + $shortSha = "${{ github.event.pull_request.head.sha }}".Substring(0, 7) + $finalVersion = "$baseVersion-pr-$shortSha" + } else { + $finalVersion = $baseVersion + } + + # Export + "NEW_VERSION=$finalVersion" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + Write-Host "Building version: $finalVersion" diff --git a/Src/Setup/BuildArchives.bat b/Src/Setup/BuildArchives.bat index 1e6339f95..b3000d7fd 100644 --- a/Src/Setup/BuildArchives.bat +++ b/Src/Setup/BuildArchives.bat @@ -20,6 +20,8 @@ cd .. cd Setup +copy /B ..\..\build\bin\Release\Utility.exe .\Final > nul + if defined APPVEYOR ( appveyor PushArtifact ..\..\build\bin\Release\Utility.exe )