From e78c96b62733a5567ca221894ba4ef29da9538ad Mon Sep 17 00:00:00 2001 From: Andrei Drexler Date: Sat, 18 Nov 2023 09:58:40 +0100 Subject: [PATCH] Retain Windows CI build artifacts --- .github/workflows/windows_ci.yml | 32 +++++++++++++++++++++++++ Windows/VisualStudio/custom_build.props | 12 ++++++++++ 2 files changed, 44 insertions(+) create mode 100644 Windows/VisualStudio/custom_build.props diff --git a/.github/workflows/windows_ci.yml b/.github/workflows/windows_ci.yml index ef35263d6..8075df4e1 100644 --- a/.github/workflows/windows_ci.yml +++ b/.github/workflows/windows_ci.yml @@ -10,6 +10,20 @@ jobs: platform: [x64, Win32] steps: - uses: actions/checkout@v3 + - name: Set environment variables + run: | + $gitrev = $(git describe --always) + $gitbranch = $(git branch --show-current) + $build_suffix = ("$gitbranch" -eq "master" -Or "$gitbranch" -eq "main") ? "-$gitrev" : "-$gitbranch-$gitrev" + $platform_alt = ("${{matrix.platform}}" -eq "x64") ? "win64" : "win32" + $platform_short = ("${{matrix.platform}}" -eq "Win32") ? "x86" : "${{matrix.platform}}" + $build_artifact = "ironwail${build_suffix}-${platform_alt}" + echo "BUILD_SUFFIX=$build_suffix" >> ${env:GITHUB_ENV} + echo "BUILD_ARTIFACT=$build_artifact" >> ${env:GITHUB_ENV} + echo "BUILD_DIR=$build_artifact" >> ${env:GITHUB_ENV} + echo "PLATFORM_ALT=$platform_alt" >> ${env:GITHUB_ENV} + echo "PLATFORM_SHORT=$platform_short" >> ${env:GITHUB_ENV} + echo "ForceImportBeforeCppTargets=${env:GITHUB_WORKSPACE}\Windows\VisualStudio\custom_build.props" >> ${env:GITHUB_ENV} - name: Build run: | $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" @@ -17,8 +31,26 @@ jobs: $options = @( ` '-property:Configuration=Release', ` '-property:Platform=${{ matrix.platform }}', ` + '-property:VER_SUFFIX=${env:BUILD_SUFFIX}', ` '-maxcpucount', ` '-verbosity:minimal' ` ) & $msbuild Windows\VisualStudio\ironwail.sln $options if (-not $?) { throw "Build failed" } + - name: Prepare archive + run: | + $compiledir = "Windows\VisualStudio\${env:BUILD_DIR}" + $zipdir = "artifact\${env:BUILD_ARTIFACT}" + mkdir $zipdir | out-null + copy ${compiledir}\*.exe $zipdir + copy ${compiledir}\*.dll $zipdir + copy Quake\ironwail.pak $zipdir + copy Quakespasm.html $zipdir + copy Quakespasm.txt $zipdir + copy Quakespasm-Music.txt $zipdir + copy LICENSE.txt $zipdir + - name: Upload archive + uses: actions/upload-artifact@v3 + with: + name: ${{ env.BUILD_ARTIFACT }} + path: artifact/* diff --git a/Windows/VisualStudio/custom_build.props b/Windows/VisualStudio/custom_build.props new file mode 100644 index 000000000..c8632be23 --- /dev/null +++ b/Windows/VisualStudio/custom_build.props @@ -0,0 +1,12 @@ + + + + + /DIRONWAIL_VER_SUFFIX=\"$(VER_SUFFIX)\" %(AdditionalOptions) + + + + $(SolutionDir)$(BUILD_DIR)\ + $(BUILD_DIR)\Out\ + +