build.yml 2.2 KB

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