1
0

build.yml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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@v4
  22. with:
  23. fetch-depth: 0
  24. - name: Set Describe
  25. shell: bash
  26. run: |
  27. describe=`git describe --tags --always`
  28. echo "describe=$describe" >> $GITHUB_ENV
  29. - name: Setup MSBuild.exe
  30. uses: microsoft/setup-msbuild@v2
  31. with:
  32. msbuild-architecture: x64
  33. - name: Update Help
  34. run: |
  35. Set-Location ..
  36. git clone https://github.com/LTCatt/PCL2Help.git -b master --single-branch --depth 1
  37. Set-Location PCL2Help
  38. Remove-Item -Path *.* -Recurse -Force
  39. Compress-Archive -Path .\* -DestinationPath .\Help.zip
  40. Copy-Item -Path .\Help.zip -Destination "${{ GITHUB.WORKSPACE }}\Plain Craft Launcher 2\Resources\Help.zip" -Force
  41. Set-Location ..
  42. Remove-Item PCL2Help -Recurse -Force
  43. Set-Location ${{ GITHUB.WORKSPACE }}
  44. - name: Replace
  45. run: |
  46. (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"
  47. (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"
  48. (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"
  49. - name: Build
  50. run: msbuild "Plain Craft Launcher 2\Plain Craft Launcher 2.vbproj" -p:Configuration=${{ matrix.configuration }}
  51. - name: Upload a Build Artifact
  52. uses: actions/upload-artifact@v4
  53. with:
  54. name: ${{ matrix.configuration }} ${{ env.describe }}
  55. path: Plain Craft Launcher 2\obj\${{ matrix.configuration }}\Plain Craft Launcher 2.exe