Skip to content

Commit

Permalink
encode version better
Browse files Browse the repository at this point in the history
  • Loading branch information
namazso committed Nov 12, 2020
1 parent eda105f commit 0f399d9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 23 deletions.
31 changes: 20 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,42 @@ jobs:
id: checktag
run: |
If($Env:GITHUB_REF -match "v([0-9]*)\.([0-9]*)\.([0-9]*)") {
Echo ("::set-output name=version::" + $Matches[0]);
Echo ("::set-output name=version_major::" + $Matches[1]);
Echo ("::set-output name=version_minor::" + $Matches[2]);
Echo ("::set-output name=version_patch::" + $Matches[3]);
$Env:CI_VERSION = $Matches[0];
$IsRelease = "yes";
$Version = $Matches[0];
$VersionMinor = $Matches[1];
$VersionMajor = $Matches[2];
$VersionPatch = $Matches[3];
} Else {
$Env:CI_VERSION = $Env:GITHUB_SHA;
$IsRelease = "no";
$Version = $Env:GITHUB_SHA;
$VersionMinor = 0;
$VersionMajor = 0;
$VersionPatch = 0;
}
Echo ("::set-output name=is_release::" + $IsRelease);
Echo ("::set-output name=version::" + $Version);
Echo ("::set-output name=version_major::" + $VersionMajor);
Echo ("::set-output name=version_minor::" + $VersionMinor);
Echo ("::set-output name=version_patch::" + $VersionPatch);
- name: setup-msbuild
uses: microsoft/setup-msbuild@v1

- name: Build Solution (x64)
run: |
cd ${{ github.workspace }}
msbuild "-property:Configuration=Release;Platform=x64" SecureUxTheme.sln
msbuild "-property:Configuration=Release;Platform=x64;CI_VERSION=${{ steps.checktag.outputs.version }}" SecureUxTheme.sln
- name: Build Solution (ARM64)
run: |
cd ${{ github.workspace }}
msbuild "-property:Configuration=Release;Platform=ARM64" SecureUxTheme.sln
msbuild "-property:Configuration=Release;Platform=ARM64;CI_VERSION=${{ steps.checktag.outputs.version }}" SecureUxTheme.sln
# Win32 built last
- name: Build Solution (Win32)
run: |
cd ${{ github.workspace }}
msbuild "-property:Configuration=Release;Platform=Win32" SecureUxTheme.sln
msbuild "-property:Configuration=Release;Platform=Win32;CI_VERSION=${{ steps.checktag.outputs.version }}" SecureUxTheme.sln
- name: Upload artifacts
uses: actions/upload-artifact@v2
Expand All @@ -62,7 +71,7 @@ jobs:
.\bin\Release\Win32\ThemeTool.pdb
- name: Create release
if: ${{ steps.checktag.outputs.version != '' }}
if: ${{ steps.checktag.outputs.is_release == 'yes' }}
id: create_release
uses: actions/create-release@v1
env:
Expand All @@ -74,7 +83,7 @@ jobs:
prerelease: true

- name: Upload release asset
if: ${{ steps.checktag.outputs.version != '' }}
if: ${{ steps.checktag.outputs.is_release == 'yes' }}
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
Expand Down
7 changes: 1 addition & 6 deletions ThemeTool/MainDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,13 +536,8 @@ void MainDialog::UpdatePatcherStateDisplay()
MainDialog::MainDialog(HWND hDlg, void*)
: _hwnd(hDlg)
{
const wchar_t* version;
if constexpr ((CI_VERSION "")[0] == 0)
version = L"(unknown)";
else
version = L"" CI_VERSION;

Log(ESTRt(L"Version %s"), version);
Log(ESTRt(L"Version " CI_VERSION));

ULONG major = 0, minor = 0, build = 0;
RtlGetNtVersionNumbers(&major, &minor, &build);
Expand Down
15 changes: 9 additions & 6 deletions ThemeTool/ThemeTool.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(CI_VERSION)'==''">
<CI_VERSION>(unknown)</CI_VERSION>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
Expand Down Expand Up @@ -128,7 +131,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>CI_VERSION=$(CI_VERSION);NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>CI_VERSION="$(CI_VERSION)";NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
Expand All @@ -149,7 +152,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>CI_VERSION=$(CI_VERSION);NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>CI_VERSION="$(CI_VERSION)";NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
Expand All @@ -168,7 +171,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>CI_VERSION=$(CI_VERSION);WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>CI_VERSION="$(CI_VERSION)";WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
Expand All @@ -184,7 +187,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>CI_VERSION=$(CI_VERSION);_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>CI_VERSION="$(CI_VERSION)";_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
Expand All @@ -200,7 +203,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>CI_VERSION=$(CI_VERSION);_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>CI_VERSION="$(CI_VERSION)";_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
Expand All @@ -218,7 +221,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>CI_VERSION=$(CI_VERSION);WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>CI_VERSION="$(CI_VERSION)";WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
Expand Down

0 comments on commit 0f399d9

Please sign in to comment.