1
0

build.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. name: Build
  2. on:
  3. push:
  4. paths:
  5. - 'Plain Craft Launcher 2/**'
  6. - '.github/workflows/**'
  7. pull_request:
  8. paths:
  9. - 'Plain Craft Launcher 2/**'
  10. - '.github/workflows/**'
  11. workflow_dispatch:
  12. jobs:
  13. build:
  14. name: Build
  15. runs-on: windows-latest
  16. strategy:
  17. matrix:
  18. configuration: [Debug, Release]
  19. steps:
  20. - name: Checkout
  21. uses: actions/checkout@v6
  22. with:
  23. fetch-depth: 1
  24. submodules: true
  25. - name: Set Describe
  26. shell: bash
  27. run: |
  28. describe=`git describe --tags --always`
  29. echo "describe=$describe" >> $GITHUB_ENV
  30. - name: Setup MSBuild.exe
  31. uses: microsoft/setup-msbuild@v3
  32. with:
  33. msbuild-architecture: x64
  34. - name: Update Help
  35. run: |
  36. Set-Location ..
  37. git clone https://github.com/LTCatt/PCL2Help.git -b master --single-branch --depth 1
  38. Set-Location PCL2Help
  39. Remove-Item -Path *.* -Recurse -Force
  40. Compress-Archive -Path .\* -DestinationPath .\Help.zip
  41. Copy-Item -Path .\Help.zip -Destination "${{ GITHUB.WORKSPACE }}\Plain Craft Launcher 2\Resources\Help.zip" -Force
  42. Set-Location ..
  43. Remove-Item PCL2Help -Recurse -Force
  44. Set-Location ${{ GITHUB.WORKSPACE }}
  45. - name: Replace
  46. run: |
  47. (gc "Plain Craft Launcher 2\Modules\ModSecret.vb") -replace 'Public OAuthClientId As String = If(Environment.GetEnvironmentVariable("PCL_MS_CLIENT_ID"), "")', 'Public OAuthClientId As String = If(Environment.GetEnvironmentVariable("PCL_MS_CLIENT_ID"), "${{ secrets.CLIENT_ID }}")' | Out-File "Plain Craft Launcher 2\Modules\ModSecret.vb"
  48. (gc "Plain Craft Launcher 2\Modules\ModSecret.vb") -replace 'Public CurseForgeAPIKey As String = If(Environment.GetEnvironmentVariable("PCL_CURSEFORGE_API_KEY"), "")', 'Public CurseForgeAPIKey As String = If(Environment.GetEnvironmentVariable("PCL_CURSEFORGE_API_KEY"), "${{ secrets.CURSEFORGE_API_KEY }}")' | Out-File "Plain Craft Launcher 2\Modules\ModSecret.vb"
  49. (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"
  50. - name: Restore NuGet Packages
  51. run: dotnet restore PCLCS\PCLCS.csproj
  52. - name: Build
  53. run: msbuild "Plain Craft Launcher 2\Plain Craft Launcher 2.vbproj" -p:Configuration=${{ matrix.configuration }}
  54. - name: Upload a Build Artifact
  55. uses: actions/upload-artifact@v7
  56. with:
  57. name: ${{ matrix.configuration }} ${{ env.describe }}
  58. path: Plain Craft Launcher 2\obj\${{ matrix.configuration }}\Plain Craft Launcher 2.exe