name: Build on: push: paths: - 'Plain Craft Launcher 2/**' - '.github/workflows/**' - 'scripts/**' pull_request: paths: - 'Plain Craft Launcher 2/**' - '.github/workflows/**' - 'scripts/**' workflow_dispatch: jobs: build: name: Build runs-on: windows-latest strategy: matrix: configuration: [Debug, Release] steps: - name: Checkout uses: actions/checkout@v6 with: fetch-depth: 1 submodules: true - name: Set Describe shell: bash run: | describe=`git describe --tags --always` echo "describe=$describe" >> $GITHUB_ENV - name: Setup MSBuild.exe uses: microsoft/setup-msbuild@v3 with: msbuild-architecture: x64 - name: Update Help run: | Set-Location .. git clone https://github.com/LTCatt/PCL2Help.git -b master --single-branch --depth 1 Set-Location PCL2Help Remove-Item -Path *.* -Recurse -Force Compress-Archive -Path .\* -DestinationPath .\Help.zip Copy-Item -Path .\Help.zip -Destination "${{ GITHUB.WORKSPACE }}\Plain Craft Launcher 2\Resources\Help.zip" -Force Set-Location .. Remove-Item PCL2Help -Recurse -Force Set-Location ${{ GITHUB.WORKSPACE }} - name: Prepare build configuration shell: pwsh env: PCL_MS_CLIENT_ID: ${{ vars.PCL_MS_CLIENT_ID || secrets.CLIENT_ID }} PCL_CURSEFORGE_API_KEY: ${{ secrets.PCL_CURSEFORGE_API_KEY || secrets.CURSEFORGE_API_KEY }} run: ./scripts/Write-BuildCredentials.ps1 - name: Set commit hash run: | (gc "Plain Craft Launcher 2\Modules\Base\ModBase.vb") -replace 'Public Const CommitHash As String = ""', 'Public Const CommitHash As String = "${{ github.sha }}"' | Out-File "Plain Craft Launcher 2\Modules\Base\ModBase.vb" - name: Restore NuGet Packages run: dotnet restore PCLCS\PCLCS.csproj - name: Build run: msbuild "Plain Craft Launcher 2\Plain Craft Launcher 2.vbproj" -p:Configuration=${{ matrix.configuration }} - name: Upload a Build Artifact uses: actions/upload-artifact@v7 with: name: ${{ matrix.configuration }} ${{ env.describe }} path: Plain Craft Launcher 2\obj\${{ matrix.configuration }}\Plain Craft Launcher 2.exe - name: Clean generated configuration if: ${{ always() }} shell: pwsh run: | $path = 'Plain Craft Launcher 2/obj/BuildCredentials.json' if (Test-Path -LiteralPath $path) { Remove-Item -LiteralPath $path -Force }