Skip to content

Commit 0f399d9

Browse files
committed
encode version better
1 parent eda105f commit 0f399d9

3 files changed

Lines changed: 30 additions & 23 deletions

File tree

.github/workflows/ci.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,42 @@ jobs:
2222
id: checktag
2323
run: |
2424
If($Env:GITHUB_REF -match "v([0-9]*)\.([0-9]*)\.([0-9]*)") {
25-
Echo ("::set-output name=version::" + $Matches[0]);
26-
Echo ("::set-output name=version_major::" + $Matches[1]);
27-
Echo ("::set-output name=version_minor::" + $Matches[2]);
28-
Echo ("::set-output name=version_patch::" + $Matches[3]);
29-
$Env:CI_VERSION = $Matches[0];
25+
$IsRelease = "yes";
26+
$Version = $Matches[0];
27+
$VersionMinor = $Matches[1];
28+
$VersionMajor = $Matches[2];
29+
$VersionPatch = $Matches[3];
3030
} Else {
31-
$Env:CI_VERSION = $Env:GITHUB_SHA;
31+
$IsRelease = "no";
32+
$Version = $Env:GITHUB_SHA;
33+
$VersionMinor = 0;
34+
$VersionMajor = 0;
35+
$VersionPatch = 0;
3236
}
37+
Echo ("::set-output name=is_release::" + $IsRelease);
38+
Echo ("::set-output name=version::" + $Version);
39+
Echo ("::set-output name=version_major::" + $VersionMajor);
40+
Echo ("::set-output name=version_minor::" + $VersionMinor);
41+
Echo ("::set-output name=version_patch::" + $VersionPatch);
3342
3443
- name: setup-msbuild
3544
uses: microsoft/setup-msbuild@v1
3645

3746
- name: Build Solution (x64)
3847
run: |
3948
cd ${{ github.workspace }}
40-
msbuild "-property:Configuration=Release;Platform=x64" SecureUxTheme.sln
49+
msbuild "-property:Configuration=Release;Platform=x64;CI_VERSION=${{ steps.checktag.outputs.version }}" SecureUxTheme.sln
4150
4251
- name: Build Solution (ARM64)
4352
run: |
4453
cd ${{ github.workspace }}
45-
msbuild "-property:Configuration=Release;Platform=ARM64" SecureUxTheme.sln
54+
msbuild "-property:Configuration=Release;Platform=ARM64;CI_VERSION=${{ steps.checktag.outputs.version }}" SecureUxTheme.sln
4655
4756
# Win32 built last
4857
- name: Build Solution (Win32)
4958
run: |
5059
cd ${{ github.workspace }}
51-
msbuild "-property:Configuration=Release;Platform=Win32" SecureUxTheme.sln
60+
msbuild "-property:Configuration=Release;Platform=Win32;CI_VERSION=${{ steps.checktag.outputs.version }}" SecureUxTheme.sln
5261
5362
- name: Upload artifacts
5463
uses: actions/upload-artifact@v2
@@ -62,7 +71,7 @@ jobs:
6271
.\bin\Release\Win32\ThemeTool.pdb
6372
6473
- name: Create release
65-
if: ${{ steps.checktag.outputs.version != '' }}
74+
if: ${{ steps.checktag.outputs.is_release == 'yes' }}
6675
id: create_release
6776
uses: actions/create-release@v1
6877
env:
@@ -74,7 +83,7 @@ jobs:
7483
prerelease: true
7584

7685
- name: Upload release asset
77-
if: ${{ steps.checktag.outputs.version != '' }}
86+
if: ${{ steps.checktag.outputs.is_release == 'yes' }}
7887
id: upload-release-asset
7988
uses: actions/upload-release-asset@v1
8089
env:

ThemeTool/MainDialog.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -536,13 +536,8 @@ void MainDialog::UpdatePatcherStateDisplay()
536536
MainDialog::MainDialog(HWND hDlg, void*)
537537
: _hwnd(hDlg)
538538
{
539-
const wchar_t* version;
540-
if constexpr ((CI_VERSION "")[0] == 0)
541-
version = L"(unknown)";
542-
else
543-
version = L"" CI_VERSION;
544539

545-
Log(ESTRt(L"Version %s"), version);
540+
Log(ESTRt(L"Version " CI_VERSION));
546541

547542
ULONG major = 0, minor = 0, build = 0;
548543
RtlGetNtVersionNumbers(&major, &minor, &build);

ThemeTool/ThemeTool.vcxproj

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@
7373
<WholeProgramOptimization>true</WholeProgramOptimization>
7474
<CharacterSet>Unicode</CharacterSet>
7575
</PropertyGroup>
76+
<PropertyGroup Condition="'$(CI_VERSION)'==''">
77+
<CI_VERSION>(unknown)</CI_VERSION>
78+
</PropertyGroup>
7679
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
7780
<ImportGroup Label="ExtensionSettings">
7881
</ImportGroup>
@@ -128,7 +131,7 @@
128131
<FunctionLevelLinking>true</FunctionLevelLinking>
129132
<IntrinsicFunctions>true</IntrinsicFunctions>
130133
<SDLCheck>true</SDLCheck>
131-
<PreprocessorDefinitions>CI_VERSION=$(CI_VERSION);NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
134+
<PreprocessorDefinitions>CI_VERSION="$(CI_VERSION)";NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
132135
<ConformanceMode>true</ConformanceMode>
133136
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
134137
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
@@ -149,7 +152,7 @@
149152
<FunctionLevelLinking>true</FunctionLevelLinking>
150153
<IntrinsicFunctions>true</IntrinsicFunctions>
151154
<SDLCheck>true</SDLCheck>
152-
<PreprocessorDefinitions>CI_VERSION=$(CI_VERSION);NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
155+
<PreprocessorDefinitions>CI_VERSION="$(CI_VERSION)";NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
153156
<ConformanceMode>true</ConformanceMode>
154157
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
155158
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
@@ -168,7 +171,7 @@
168171
<PrecompiledHeader>Use</PrecompiledHeader>
169172
<WarningLevel>Level3</WarningLevel>
170173
<SDLCheck>true</SDLCheck>
171-
<PreprocessorDefinitions>CI_VERSION=$(CI_VERSION);WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
174+
<PreprocessorDefinitions>CI_VERSION="$(CI_VERSION)";WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
172175
<ConformanceMode>true</ConformanceMode>
173176
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
174177
<LanguageStandard>stdcpp17</LanguageStandard>
@@ -184,7 +187,7 @@
184187
<PrecompiledHeader>Use</PrecompiledHeader>
185188
<WarningLevel>Level3</WarningLevel>
186189
<SDLCheck>true</SDLCheck>
187-
<PreprocessorDefinitions>CI_VERSION=$(CI_VERSION);_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
190+
<PreprocessorDefinitions>CI_VERSION="$(CI_VERSION)";_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
188191
<ConformanceMode>true</ConformanceMode>
189192
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
190193
<LanguageStandard>stdcpp17</LanguageStandard>
@@ -200,7 +203,7 @@
200203
<PrecompiledHeader>Use</PrecompiledHeader>
201204
<WarningLevel>Level3</WarningLevel>
202205
<SDLCheck>true</SDLCheck>
203-
<PreprocessorDefinitions>CI_VERSION=$(CI_VERSION);_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
206+
<PreprocessorDefinitions>CI_VERSION="$(CI_VERSION)";_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
204207
<ConformanceMode>true</ConformanceMode>
205208
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
206209
<LanguageStandard>stdcpp17</LanguageStandard>
@@ -218,7 +221,7 @@
218221
<FunctionLevelLinking>true</FunctionLevelLinking>
219222
<IntrinsicFunctions>true</IntrinsicFunctions>
220223
<SDLCheck>true</SDLCheck>
221-
<PreprocessorDefinitions>CI_VERSION=$(CI_VERSION);WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
224+
<PreprocessorDefinitions>CI_VERSION="$(CI_VERSION)";WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
222225
<ConformanceMode>true</ConformanceMode>
223226
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
224227
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>

0 commit comments

Comments
 (0)