build.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. env:
  17. configuration: Debug
  18. steps:
  19. - name: Checkout
  20. uses: actions/checkout@v4
  21. with:
  22. fetch-depth: 0
  23. - name: Set Describe
  24. shell: bash
  25. run: |
  26. describe=`git describe --tags --always`
  27. echo "describe=$describe" >> $GITHUB_ENV
  28. - name: Setup MSBuild.exe
  29. uses: microsoft/setup-msbuild@v2
  30. with:
  31. msbuild-architecture: x64
  32. - name: Replace
  33. shell: powershell
  34. run: |
  35. (gc "Plain Craft Launcher 2\Modules\Minecraft\ModLaunch.vb") -replace 'Dim ClientId As String = ""', 'Dim ClientId As String = "${{ secrets.CLIENT_ID }}"' | Out-File "Plain Craft Launcher 2\Modules\Minecraft\ModLaunch.vb"
  36. (gc "Plain Craft Launcher 2\Modules\ModSecret.vb") -replace 'Client.Headers\("x-api-key"\) = ""', 'Client.Headers("x-api-key") = "${{ secrets.X_API_KEY }}"' | Out-File "Plain Craft Launcher 2\Modules\ModSecret.vb"
  37. (gc "Plain Craft Launcher 2\Modules\ModSecret.vb") -replace 'Request.Headers\("x-api-key"\) = ""', 'Request.Headers("x-api-key") = "${{ secrets.X_API_KEY }}"' | Out-File "Plain Craft Launcher 2\Modules\ModSecret.vb"
  38. - name: Build
  39. run: msbuild "Plain Craft Launcher 2\Plain Craft Launcher 2.vbproj" -p:Configuration=${{ env.configuration }}
  40. - name: Upload a Build Artifact
  41. uses: actions/upload-artifact@v4
  42. with:
  43. name: ${{ env.configuration }} ${{ env.describe }}
  44. path: Plain Craft Launcher 2\obj\Debug\Plain Craft Launcher 2.exe