Skip to content

Commit b8536ea

Browse files
authored
Update main.yml #GITBUILD
test installer version number
1 parent b371643 commit b8536ea

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

.github/workflows/main.yml

+33-4
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,40 @@ jobs:
6666
shell: cmd
6767
run: call .\ArtifactBuild.cmd
6868

69-
# Bump version for installer
70-
- name: Bump Installer Version
69+
# 1) Compute a wrapped major.minor.build from the run number
70+
- name: Compute installer version
7171
if: env.build_trigger == 'true'
72-
shell: cmd
73-
run: call .\InstallerBumpVersion.bat
72+
shell: bash
73+
run: |
74+
TOTAL=${{ github.run_number }}
75+
BUILD=$(( TOTAL % 65536 ))
76+
MINOR_TOTAL=$(( TOTAL / 65536 ))
77+
MINOR=$(( MINOR_TOTAL % 256 ))
78+
MAJOR=$(( MINOR_TOTAL / 256 ))
79+
echo "INSTALLER_MAJOR=$MAJOR" >> $GITHUB_ENV
80+
echo "INSTALLER_MINOR=$MINOR" >> $GITHUB_ENV
81+
echo "INSTALLER_BUILD=$BUILD" >> $GITHUB_ENV
82+
echo "INSTALLER_VER=$MAJOR.$MINOR.$BUILD" >> $GITHUB_ENV
83+
echo "Computed installer version → $MAJOR.$MINOR.$BUILD (run #${{ github.run_number }})"
84+
85+
# 2) Patch your .vdproj in place (inject ProductVersion and a new GUID)
86+
- name: Patch .vdproj ProductVersion & ProductCode
87+
if: env.build_trigger == 'true'
88+
shell: pwsh
89+
run: |
90+
$proj = 'UnityLauncherProInstaller\UnityLauncherProInstaller.vdproj'
91+
$ver = "${{ env.INSTALLER_VER }}"
92+
$guid = [guid]::NewGuid().ToString("B").ToUpper()
93+
94+
(Get-Content $proj) |
95+
ForEach-Object {
96+
$_ -replace '("ProductVersion"\s*=\s*"8:)[^"]+"', "`$1$ver`"" `
97+
-replace '("ProductCode"\s*=\s*"8:)\{[^}]+\}"', "`$1{$guid}`""
98+
} |
99+
Set-Content $proj
100+
101+
Write-Host "→ ProductVersion patched to $ver"
102+
Write-Host "→ ProductCode patched to $guid"
74103
75104
# Check that output exists
76105
- name: Validate UnityLauncherPro.exe exists

0 commit comments

Comments
 (0)