diff --git a/.github/workflows/windows_ci.yml b/.github/workflows/windows_ci.yml index ef35263d6..eae456341 100644 --- a/.github/workflows/windows_ci.yml +++ b/.github/workflows/windows_ci.yml @@ -10,6 +10,10 @@ jobs: platform: [x64, Win32] steps: - uses: actions/checkout@v3 + - name: Set env + run: | + $suffix = $(Windows\VisualStudio\print_build_suffix.bat) + echo "BUILD_SUFFIX=${suffix}" >> ${env:GITHUB_ENV} - name: Build run: | $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" @@ -17,8 +21,22 @@ jobs: $options = @( ` '-property:Configuration=Release', ` '-property:Platform=${{ matrix.platform }}', ` + '-property:ForceImportBeforeCppTargets=Windows\VisualStudio\custom_build.props', ` + '-property:VER_SUFFIX=${env:BUILD_SUFFIX}', ` '-maxcpucount', ` '-verbosity:minimal' ` ) & $msbuild Windows\VisualStudio\ironwail.sln $options if (-not $?) { throw "Build failed" } + - name: Upload build + uses: actions/upload-artifact@v3 + with: + name: ironwail${{ env.BUILD_SUFFIX }}-${{ matrix.platform }} + path: | + Windows\VisualStudio\Build-ironwail\**\*.exe + Windows\VisualStudio\Build-ironwail\**\*.dll + Quake\ironwail.pak + Quakespasm.html + Quakespasm.txt + Quakespasm-Music.txt + LICENSE.txt 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\ + + diff --git a/Windows/VisualStudio/print_build_suffix.bat b/Windows/VisualStudio/print_build_suffix.bat new file mode 100644 index 000000000..84b053f38 --- /dev/null +++ b/Windows/VisualStudio/print_build_suffix.bat @@ -0,0 +1,10 @@ +@echo off +::Print build suffix (either -hash or -branch-hash) + +for /f %%f in ('git describe --always') do set gitrev=%%f +for /f %%f in ('git branch --show-current') do set gitbranch=%%f +if /i "%gitbranch%" == "master" ( + echo -%gitrev% +) else ( + echo -%gitbranch%-%gitrev% +)