diff --git a/.github/workflows/windows_ci.yml b/.github/workflows/windows_ci.yml index ef35263d6..2976652d8 100644 --- a/.github/workflows/windows_ci.yml +++ b/.github/workflows/windows_ci.yml @@ -10,6 +10,17 @@ 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" + echo "BUILD_SUFFIX=$build_suffix" >> ${env:GITHUB_ENV} + echo "BUILD_ARTIFACT=ironwail${build_suffix}-${platform_alt}" >> ${env:GITHUB_ENV} + echo "BUILD_DIR=ironwail${build_suffix}-${platform_alt}" >> ${env:GITHUB_ENV} + echo "PLATFORM_ALT=$platform_alt" >> ${env:GITHUB_ENV} + echo "PLATFORM_SHORT=$platform_short" >> ${env:GITHUB_ENV} - name: Build run: | $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" @@ -17,8 +28,28 @@ jobs: $options = @( ` '-property:Configuration=Release', ` '-property:Platform=${{ matrix.platform }}', ` + '-property:ForceImportBeforeCppTargets=Windows\VisualStudio\custom_build.props', ` + '-property:VER_SUFFIX=${env:BUILD_SUFFIX}', ` + '-property:BUILD_DIR=${env:BUILD_ARTIFACT}', ` '-maxcpucount', ` '-verbosity:minimal' ` ) & $msbuild Windows\VisualStudio\ironwail.sln $options if (-not $?) { throw "Build failed" } + - name: Prepare archive + run: | + rmdir -Force -Recurse ${env:BUILD_ARTIFACT}\Out + del ${env:BUILD_ARTIFACT}\ironwail.exp + del ${env:BUILD_ARTIFACT}\ironwail.lib + del ${env:BUILD_ARTIFACT}\ironwail.pdb + copy Quake\ironwail.pak ${env:BUILD_ARTIFACT} + copy Quakespasm.html ${env:BUILD_ARTIFACT} + copy Quakespasm.txt ${env:BUILD_ARTIFACT} + copy Quakespasm-Music.txt ${env:BUILD_ARTIFACT} + copy LICENSE.txt ${env:BUILD_ARTIFACT} + - name: Upload archive + uses: actions/upload-artifact@v3 + with: + name: ${{ env.BUILD_ARTIFACT }} + path: | + ${{ env.BUILD_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\ + +