1
0

build.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. strategy:
  19. matrix:
  20. configuration: [Debug]
  21. runs-on: windows-latest
  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=${{ matrix.configuration }}
  44. - name: Upload a Build Artifact
  45. uses: actions/upload-artifact@v4
  46. with:
  47. name: ${{ matrix.configuration }} ${{ env.Describe }}
  48. path: Plain Craft Launcher 2\obj\${{ matrix.configuration }}\Plain Craft Launcher 2.exe
  49. - name: Create Release
  50. if: ${{ inputs.Release }}
  51. id: create_release
  52. uses: actions/create-release@latest
  53. env:
  54. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  55. with:
  56. tag_name: ${{ env.Describe }}
  57. release_name: ${{ env.Describe }}
  58. - name: Upload Release Asset
  59. if: ${{ inputs.Release }}
  60. id: upload-release-asset
  61. uses: actions/upload-release-asset@latest
  62. env:
  63. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  64. with:
  65. upload_url: ${{ steps.create_release.outputs.upload_url }}
  66. asset_path: Plain Craft Launcher 2\obj\${{ matrix.configuration }}\Plain Craft Launcher 2.exe
  67. asset_name: Plain Craft Launcher 2.exe
  68. asset_content_type: application/octet-stream