Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 2 additions & 0 deletions Src/Setup/BuildArchives.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down