build.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. inputs:
  13. release:
  14. description: 'Release'
  15. type: boolean
  16. jobs:
  17. build:
  18. name: Build
  19. runs-on: windows-latest
  20. env:
  21. configuration: Debug
  22. steps:
  23. - name: Checkout
  24. uses: actions/checkout@v4
  25. with:
  26. fetch-depth: 0
  27. - name: Set Describe
  28. shell: bash
  29. run: |
  30. describe=`git describe --tags --always`
  31. echo "describe=$describe" >> $GITHUB_ENV
  32. - name: Setup MSBuild.exe
  33. uses: microsoft/setup-msbuild@v2
  34. with:
  35. msbuild-architecture: x64
  36. - name: Replace
  37. shell: powershell
  38. run: |
  39. (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"
  40. (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"
  41. (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"
  42. - name: Build
  43. run: msbuild "Plain Craft Launcher 2\Plain Craft Launcher 2.vbproj" -p:Configuration=${{ env.configuration }}
  44. - name: Upload a Build Artifact
  45. uses: actions/upload-artifact@v4
  46. with:
  47. name: ${{ env.configuration }} ${{ env.describe }}
  48. path: Plain Craft Launcher 2\obj\Debug\Plain Craft Launcher 2.exe
  49. - name: Release
  50. if: ${{ inputs.Release }}
  51. uses: softprops/action-gh-release@v2
  52. env:
  53. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  54. with:
  55. name: ${{ env.describe }}
  56. tag_name: ${{ env.describe }}
  57. files: Plain Craft Launcher 2\obj\${{ env.configuration }}\Plain Craft Launcher 2.exe