|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, master] |
| 6 | + tags: ['v*'] |
| 7 | + pull_request: |
| 8 | + branches: [main, master] |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +jobs: |
| 12 | + # ──── Android AAR ──── |
| 13 | + android: |
| 14 | + name: Android AAR |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Set up JDK 17 |
| 20 | + uses: actions/setup-java@v4 |
| 21 | + with: |
| 22 | + distribution: temurin |
| 23 | + java-version: 17 |
| 24 | + |
| 25 | + - name: Set up Android SDK |
| 26 | + uses: android-actions/setup-android@v3 |
| 27 | + with: |
| 28 | + packages: | |
| 29 | + platforms;android-35 |
| 30 | + ndk;27.2.12479018 |
| 31 | + build-tools;35.0.0 |
| 32 | +
|
| 33 | + - name: Setup Gradle |
| 34 | + uses: gradle/actions/setup-gradle@v3 |
| 35 | + |
| 36 | + - name: Build AAR |
| 37 | + working-directory: Android |
| 38 | + run: ./gradlew :library:assembleRelease |
| 39 | + |
| 40 | + - name: Upload AAR |
| 41 | + uses: actions/upload-artifact@v4 |
| 42 | + with: |
| 43 | + name: library-release.aar |
| 44 | + path: Android/library/build/outputs/aar/library-release.aar |
| 45 | + |
| 46 | + # ──── .NET Manager ──── |
| 47 | + manager: |
| 48 | + name: .NET Manager |
| 49 | + runs-on: ubuntu-latest |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v4 |
| 52 | + |
| 53 | + - name: Set up .NET 10 |
| 54 | + uses: actions/setup-dotnet@v4 |
| 55 | + with: |
| 56 | + dotnet-version: '10.0.x' |
| 57 | + |
| 58 | + - name: Build |
| 59 | + working-directory: StArray.ModManager |
| 60 | + run: dotnet build -c Release |
| 61 | + |
| 62 | + - name: Package output (exclude runtimes) |
| 63 | + run: | |
| 64 | + src="StArray.ModManager/bin/Release/net10.0" |
| 65 | + dst="artifacts" |
| 66 | + mkdir -p "$dst" |
| 67 | + cp -r "$src"/* "$dst/" |
| 68 | + rm -rf "$dst/runtimes" |
| 69 | + cd "$dst" && zip -r ../manager-release.zip . && cd .. |
| 70 | +
|
| 71 | + - name: Upload Manager |
| 72 | + uses: actions/upload-artifact@v4 |
| 73 | + with: |
| 74 | + name: manager-release.zip |
| 75 | + path: manager-release.zip |
| 76 | + |
| 77 | + # ──── Release (tag only) ──── |
| 78 | + release: |
| 79 | + if: startsWith(github.ref, 'refs/tags/v') |
| 80 | + needs: [android, manager] |
| 81 | + runs-on: ubuntu-latest |
| 82 | + permissions: |
| 83 | + contents: write |
| 84 | + steps: |
| 85 | + - uses: actions/download-artifact@v4 |
| 86 | + with: |
| 87 | + pattern: '*' |
| 88 | + merge-multiple: true |
| 89 | + path: artifacts |
| 90 | + |
| 91 | + - name: Create GitHub Release |
| 92 | + uses: softprops/action-gh-release@v2 |
| 93 | + with: |
| 94 | + files: | |
| 95 | + artifacts/library-release.aar |
| 96 | + artifacts/manager-release.zip |
| 97 | + generate_release_notes: true |
0 commit comments