GitHub Actions workflow for building the project #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
# Path to the solution file relative to the root of the project. | |
SOLUTION_FILE_PATH: .\Textify.sln | |
# Configuration type to build. | |
# You can convert this to a build matrix if you need coverage of multiple configuration types. | |
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
BUILD_CONFIGURATION: Release | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Reference: | |
# https://github.com/JACoders/OpenJK/blob/ad98f609c4ac1c4b825db18f324fc54211296def/.github/workflows/build-deprecated.yml#L27 | |
- name: Install v141_xp Toolchain | |
continue-on-error: true | |
shell: powershell | |
run: | | |
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\" | |
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" | |
$WorkLoads = '--add Microsoft.VisualStudio.Component.WinXP' | |
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"", $WorkLoads, '--quiet', '--norestart', '--nocache') | |
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden | |
if ($process.ExitCode -eq 0) { | |
Write-Host "components have been successfully added" | |
} else { | |
Write-Host "components were not installed" | |
} | |
- name: Add MSBuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: Restore Packages | |
run: nuget restore ${{ env.SOLUTION_FILE_PATH }} | |
- name: Build Win32 | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
# Add additional options to the MSBuild command line here (like platform or verbosity level). | |
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference | |
run: msbuild /m /p:Configuration=${{ env.BUILD_CONFIGURATION }} /p:Platform="Win32" ${{ env.SOLUTION_FILE_PATH }} | |
- name: Package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Textify | |
path: Release\Textify.exe |