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