3939 with :
4040 dotnet-version : ' 10.0.x'
4141
42+ - name : Extract version from Se.cs
43+ shell : pwsh
44+ run : |
45+ $seContent = Get-Content "src/ui/Logic/Config/Se.cs" -Raw
46+ $m = [regex]::Match($seContent, 'public\s+static\s+string\s+Version\s*\{[^}]+\}\s*=\s*"v([^"]+)"')
47+ if (-not $m.Success) { throw "Could not find Version in Se.cs" }
48+ $versionString = $m.Groups[1].Value
49+ $parts = $versionString -split '-', 2
50+ $numericFields = $parts[0].Split('.')
51+ $major = [int]$numericFields[0]
52+ $minor = if ($numericFields.Length -gt 1) { [int]$numericFields[1] } else { 0 }
53+ $build = if ($numericFields.Length -gt 2) { [int]$numericFields[2] } else { 0 }
54+ $revision = 0
55+ if ($parts.Length -gt 1) {
56+ $rm = [regex]::Match($parts[1], '\d+$')
57+ if ($rm.Success) { $revision = [int]$rm.Value }
58+ }
59+ $appVerFull = "$major.$minor.$build.$revision"
60+ "APP_VER_DISPLAY=$versionString" >> $env:GITHUB_ENV
61+ "APP_VER_FULL=$appVerFull" >> $env:GITHUB_ENV
62+ Write-Host "APP_VER_DISPLAY=$versionString"
63+ Write-Host "APP_VER_FULL=$appVerFull"
64+
4265 - name : Restore dependencies
4366 run : dotnet restore
4467
@@ -49,12 +72,18 @@ jobs:
4972 run : |
5073 dotnet publish src/seconv/SeConv.csproj -c ${{ inputs.build_configuration }} -r win-x64 --self-contained true `
5174 -p:PublishSingleFile=true `
75+ -p:Version=$env:APP_VER_FULL `
76+ -p:FileVersion=$env:APP_VER_FULL `
77+ -p:InformationalVersion=$env:APP_VER_DISPLAY `
5278 -o ./publish/windows-x64
5379
5480 - name : Publish Windows ARM64
5581 run : |
5682 dotnet publish src/seconv/SeConv.csproj -c ${{ inputs.build_configuration }} -r win-arm64 --self-contained true `
5783 -p:PublishSingleFile=true `
84+ -p:Version=$env:APP_VER_FULL `
85+ -p:FileVersion=$env:APP_VER_FULL `
86+ -p:InformationalVersion=$env:APP_VER_DISPLAY `
5887 -o ./publish/windows-arm64
5988
6089 - name : Remove PDB files
@@ -83,6 +112,28 @@ jobs:
83112 uses : actions/setup-dotnet@v4
84113 with :
85114 dotnet-version : ' 10.0.x'
115+ - name : Extract version from Se.cs
116+ run : |
117+ set -e
118+ line=$(grep -E 'public[[:space:]]+static[[:space:]]+string[[:space:]]+Version[[:space:]]*\{' src/ui/Logic/Config/Se.cs)
119+ version_string=$(printf '%s' "$line" | sed -E 's/.*"v([^"]+)".*/\1/')
120+ numeric_part="${version_string%%-*}"
121+ suffix=""
122+ case "$version_string" in
123+ *-*) suffix="${version_string#*-}" ;;
124+ esac
125+ dot_count=$(printf '%s' "$numeric_part" | tr -cd '.' | wc -c | tr -d ' ')
126+ case "$dot_count" in
127+ 0) numeric_part="${numeric_part}.0.0" ;;
128+ 1) numeric_part="${numeric_part}.0" ;;
129+ esac
130+ revision=$(printf '%s' "$suffix" | grep -oE '[0-9]+$' || true)
131+ revision=${revision:-0}
132+ app_ver_full="${numeric_part}.${revision}"
133+ echo "APP_VER_DISPLAY=$version_string" >> "$GITHUB_ENV"
134+ echo "APP_VER_FULL=$app_ver_full" >> "$GITHUB_ENV"
135+ echo "APP_VER_DISPLAY=$version_string"
136+ echo "APP_VER_FULL=$app_ver_full"
86137 - name : Restore dependencies
87138 run : dotnet restore
88139 - name : Build
@@ -92,13 +143,19 @@ jobs:
92143 run : |
93144 dotnet publish src/seconv/SeConv.csproj -c ${{ inputs.build_configuration }} -r osx-x64 --self-contained true \
94145 -p:PublishSingleFile=true \
146+ -p:Version="$APP_VER_FULL" \
147+ -p:FileVersion="$APP_VER_FULL" \
148+ -p:InformationalVersion="$APP_VER_DISPLAY" \
95149 -o ./publish/macos-x64
96150 find "./publish/macos-x64/" -name "*.pdb" -type f -delete
97151
98152 - name : Publish macOS ARM64
99153 run : |
100154 dotnet publish src/seconv/SeConv.csproj -c ${{ inputs.build_configuration }} -r osx-arm64 --self-contained true \
101155 -p:PublishSingleFile=true \
156+ -p:Version="$APP_VER_FULL" \
157+ -p:FileVersion="$APP_VER_FULL" \
158+ -p:InformationalVersion="$APP_VER_DISPLAY" \
102159 -o ./publish/macos-arm64
103160 find "./publish/macos-arm64/" -name "*.pdb" -type f -delete
104161
@@ -126,6 +183,29 @@ jobs:
126183 with :
127184 dotnet-version : ' 10.0.x'
128185
186+ - name : Extract version from Se.cs
187+ run : |
188+ set -e
189+ line=$(grep -E 'public[[:space:]]+static[[:space:]]+string[[:space:]]+Version[[:space:]]*\{' src/ui/Logic/Config/Se.cs)
190+ version_string=$(printf '%s' "$line" | sed -E 's/.*"v([^"]+)".*/\1/')
191+ numeric_part="${version_string%%-*}"
192+ suffix=""
193+ case "$version_string" in
194+ *-*) suffix="${version_string#*-}" ;;
195+ esac
196+ dot_count=$(printf '%s' "$numeric_part" | tr -cd '.' | wc -c | tr -d ' ')
197+ case "$dot_count" in
198+ 0) numeric_part="${numeric_part}.0.0" ;;
199+ 1) numeric_part="${numeric_part}.0" ;;
200+ esac
201+ revision=$(printf '%s' "$suffix" | grep -oE '[0-9]+$' || true)
202+ revision=${revision:-0}
203+ app_ver_full="${numeric_part}.${revision}"
204+ echo "APP_VER_DISPLAY=$version_string" >> "$GITHUB_ENV"
205+ echo "APP_VER_FULL=$app_ver_full" >> "$GITHUB_ENV"
206+ echo "APP_VER_DISPLAY=$version_string"
207+ echo "APP_VER_FULL=$app_ver_full"
208+
129209 - name : Restore dependencies
130210 run : dotnet restore
131211
@@ -136,12 +216,18 @@ jobs:
136216 run : |
137217 dotnet publish src/seconv/SeConv.csproj -c ${{ inputs.build_configuration }} -r linux-x64 --self-contained true \
138218 -p:PublishSingleFile=true \
219+ -p:Version="$APP_VER_FULL" \
220+ -p:FileVersion="$APP_VER_FULL" \
221+ -p:InformationalVersion="$APP_VER_DISPLAY" \
139222 -o ./publish/linux-x64
140223
141224 - name : Publish Linux ARM64
142225 run : |
143226 dotnet publish src/seconv/SeConv.csproj -c ${{ inputs.build_configuration }} -r linux-arm64 --self-contained true \
144227 -p:PublishSingleFile=true \
228+ -p:Version="$APP_VER_FULL" \
229+ -p:FileVersion="$APP_VER_FULL" \
230+ -p:InformationalVersion="$APP_VER_DISPLAY" \
145231 -o ./publish/linux-arm64
146232
147233 - name : Remove PDB files from Linux artifacts
0 commit comments