|
| 1 | +name: Build Haxor (SE5) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + paths: |
| 7 | + - 'se5/Haxor/**' |
| 8 | + - '.github/workflows/haxor.yml' |
| 9 | + pull_request: |
| 10 | + paths: |
| 11 | + - 'se5/Haxor/**' |
| 12 | + - '.github/workflows/haxor.yml' |
| 13 | + workflow_dispatch: |
| 14 | + inputs: |
| 15 | + tag: |
| 16 | + description: 'Release tag to publish the zips under (e.g. se5-haxor-v1.0). Leave empty to build artifacts only.' |
| 17 | + required: false |
| 18 | + type: string |
| 19 | + |
| 20 | +jobs: |
| 21 | + build: |
| 22 | + runs-on: ubuntu-latest |
| 23 | + strategy: |
| 24 | + fail-fast: false |
| 25 | + matrix: |
| 26 | + include: |
| 27 | + - rid: win-x64 |
| 28 | + os: windows |
| 29 | + exe: Haxor.exe |
| 30 | + - rid: win-arm64 |
| 31 | + os: windows |
| 32 | + exe: Haxor.exe |
| 33 | + - rid: linux-x64 |
| 34 | + os: linux |
| 35 | + exe: Haxor |
| 36 | + - rid: linux-arm64 |
| 37 | + os: linux |
| 38 | + exe: Haxor |
| 39 | + - rid: osx-x64 |
| 40 | + os: macos |
| 41 | + exe: Haxor |
| 42 | + - rid: osx-arm64 |
| 43 | + os: macos |
| 44 | + exe: Haxor |
| 45 | + |
| 46 | + steps: |
| 47 | + - name: Checkout |
| 48 | + uses: actions/checkout@v4 |
| 49 | + |
| 50 | + - name: Setup .NET 8 |
| 51 | + uses: actions/setup-dotnet@v4 |
| 52 | + with: |
| 53 | + dotnet-version: '8.0.x' |
| 54 | + |
| 55 | + - name: Publish self-contained (${{ matrix.rid }}) |
| 56 | + working-directory: se5/Haxor |
| 57 | + run: | |
| 58 | + dotnet publish Haxor.csproj \ |
| 59 | + -c Release \ |
| 60 | + -r ${{ matrix.rid }} \ |
| 61 | + --self-contained true \ |
| 62 | + -p:PublishSingleFile=true \ |
| 63 | + -p:IncludeNativeLibrariesForSelfExtract=true \ |
| 64 | + -o staging/Haxor |
| 65 | +
|
| 66 | + - name: Rewrite plugin.json for ${{ matrix.os }} |
| 67 | + working-directory: se5/Haxor |
| 68 | + run: | |
| 69 | + jq ' |
| 70 | + del(.runtime, .entry) | |
| 71 | + .executables = { "${{ matrix.os }}": "${{ matrix.exe }}" } |
| 72 | + ' plugin.json > staging/Haxor/plugin.json |
| 73 | +
|
| 74 | + - name: Package zip |
| 75 | + working-directory: se5/Haxor/staging |
| 76 | + run: zip -r "$GITHUB_WORKSPACE/Haxor-${{ matrix.rid }}.zip" Haxor |
| 77 | + |
| 78 | + - name: Upload artifact |
| 79 | + uses: actions/upload-artifact@v4 |
| 80 | + with: |
| 81 | + name: Haxor-${{ matrix.rid }} |
| 82 | + path: Haxor-${{ matrix.rid }}.zip |
| 83 | + |
| 84 | + release: |
| 85 | + name: Publish GitHub Release |
| 86 | + needs: build |
| 87 | + if: github.event_name == 'workflow_dispatch' && github.event.inputs.tag != '' |
| 88 | + runs-on: ubuntu-latest |
| 89 | + permissions: |
| 90 | + contents: write |
| 91 | + steps: |
| 92 | + - name: Download all zips |
| 93 | + uses: actions/download-artifact@v4 |
| 94 | + with: |
| 95 | + path: dist |
| 96 | + pattern: Haxor-* |
| 97 | + merge-multiple: true |
| 98 | + |
| 99 | + - name: Create release and upload zips |
| 100 | + env: |
| 101 | + GH_TOKEN: ${{ github.token }} |
| 102 | + run: | |
| 103 | + gh release create "${{ github.event.inputs.tag }}" dist/Haxor-*.zip \ |
| 104 | + --repo "${{ github.repository }}" \ |
| 105 | + --target "${{ github.sha }}" \ |
| 106 | + --title "Haxor ${{ github.event.inputs.tag }}" \ |
| 107 | + --notes "Self-contained Haxor plugin builds for win/linux/osx (x64 + arm64)." |
0 commit comments