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. 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. run: |
  38. (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"
  39. (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"
  40. (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"
  41. - name: Build
  42. run: msbuild "Plain Craft Launcher 2\Plain Craft Launcher 2.vbproj" -p:Configuration=${{ env.configuration }}
  43. - name: dir
  44. shell: cmd
  45. run: dir /s
  46. - name: Upload a Build Artifact
  47. uses: actions/upload-artifact@v4
  48. with:
  49. name: ${{ env.configuration }} ${{ env.describe }}
  50. path: ${{ GITHUB.WORKSPACE }}\Plain Craft Launcher 2\obj\Debug\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: ${{ GITHUB.WORKSPACE }}\Plain Craft Launcher 2\obj\${{ env.configuration }}\Plain Craft Launcher 2.exe