diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1197e05..714251f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,6 +24,33 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Install vpatch + shell: pwsh + run: | + dotnet tool install --global Nefarius.Tools.Vpatch + "$env:USERPROFILE\.dotnet\tools" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + - name: Stamp version in resource file + shell: pwsh + run: | + $tagVersion = "${{ github.ref_name }}".TrimStart("v") + $versionParts = $tagVersion.Split(".") + if ($versionParts.Count -eq 3) { + $tagVersion = "$tagVersion.0" + } + elseif ($versionParts.Count -ne 4) { + throw "Unsupported tag version format '$tagVersion'. Expected 3 or 4 numeric segments." + } + + $versionParts = $tagVersion.Split(".") + foreach ($part in $versionParts) { + if ($part -notmatch '^\d+$') { + throw "Unsupported tag version '$tagVersion'. Each segment in versionParts must be numeric before calling vpatch." + } + } + + vpatch --stamp-version "$tagVersion" --target-file "Injector/Injector.rc" --resource.file-version --resource.product-version + - name: Add MSBuild to PATH uses: microsoft/setup-msbuild@v2 diff --git a/.gitignore b/.gitignore index 8a30d25..55b3ba4 100644 --- a/.gitignore +++ b/.gitignore @@ -396,3 +396,4 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml +/.release-local