|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + release: |
| 6 | + types: [published] |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-android: |
| 10 | + name: Build Android |
| 11 | + runs-on: windows-latest |
| 12 | + env: |
| 13 | + ANDROID_KEYSTORE_FILE: ${{ secrets.ANDROID_KEYSTORE_FILE }} |
| 14 | + ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} |
| 15 | + ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} |
| 16 | + ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Setup Java |
| 22 | + uses: actions/setup-java@v4 |
| 23 | + with: |
| 24 | + distribution: 'microsoft' |
| 25 | + java-version: '11' |
| 26 | + |
| 27 | + - name: Setup .NET |
| 28 | + uses: actions/setup-dotnet@v4 |
| 29 | + with: |
| 30 | + dotnet-version: '8.0.x' |
| 31 | + |
| 32 | + - name: Install Android Workload |
| 33 | + run: dotnet workload install android wasi-experimental |
| 34 | + |
| 35 | + - name: Decode Keystore |
| 36 | + if: env.ANDROID_KEYSTORE_FILE != '' |
| 37 | + run: | |
| 38 | + $bytes = [System.Convert]::FromBase64String($env:ANDROID_KEYSTORE_FILE) |
| 39 | + [System.IO.File]::WriteAllBytes("keystore.jks", $bytes) |
| 40 | + shell: pwsh |
| 41 | + |
| 42 | + - name: Build Android (Signed) |
| 43 | + if: env.ANDROID_KEYSTORE_FILE != '' |
| 44 | + run: > |
| 45 | + dotnet publish -c Release -f net8.0-android osu.Android/osu.Android.csproj |
| 46 | + -p:AndroidKeyStore=true |
| 47 | + -p:AndroidSigningKeyStore=keystore.jks |
| 48 | + -p:AndroidSigningStorePass="$env:ANDROID_KEYSTORE_PASSWORD" |
| 49 | + -p:AndroidSigningKeyAlias="$env:ANDROID_KEY_ALIAS" |
| 50 | + -p:AndroidSigningKeyPass="$env:ANDROID_KEY_PASSWORD" |
| 51 | +
|
| 52 | + - name: Build Android (Unsigned) |
| 53 | + if: env.ANDROID_KEYSTORE_FILE == '' |
| 54 | + run: dotnet publish -c Release -f net8.0-android osu.Android/osu.Android.csproj |
| 55 | + |
| 56 | + - name: Upload Artifact |
| 57 | + uses: actions/upload-artifact@v4 |
| 58 | + with: |
| 59 | + name: osu-android |
| 60 | + path: osu.Android/bin/Release/net8.0-android/*.apk |
| 61 | + |
| 62 | + build-windows: |
| 63 | + name: Build Windows |
| 64 | + runs-on: windows-latest |
| 65 | + steps: |
| 66 | + - name: Checkout |
| 67 | + uses: actions/checkout@v4 |
| 68 | + |
| 69 | + - name: Setup .NET |
| 70 | + uses: actions/setup-dotnet@v4 |
| 71 | + with: |
| 72 | + dotnet-version: '8.0.x' |
| 73 | + |
| 74 | + - name: Build Windows |
| 75 | + run: dotnet publish -c Release -r win-x64 --self-contained osu.Desktop/osu.Desktop.csproj -o publish/win-x64 |
| 76 | + |
| 77 | + - name: Compress Windows Build |
| 78 | + run: Compress-Archive -Path publish/win-x64/* -DestinationPath osu-win-x64.zip |
| 79 | + |
| 80 | + - name: Upload Artifact |
| 81 | + uses: actions/upload-artifact@v4 |
| 82 | + with: |
| 83 | + name: osu-win-x64 |
| 84 | + path: osu-win-x64.zip |
| 85 | + |
| 86 | + build-linux: |
| 87 | + name: Build Linux |
| 88 | + runs-on: ubuntu-latest |
| 89 | + steps: |
| 90 | + - name: Checkout |
| 91 | + uses: actions/checkout@v4 |
| 92 | + |
| 93 | + - name: Setup .NET |
| 94 | + uses: actions/setup-dotnet@v4 |
| 95 | + with: |
| 96 | + dotnet-version: '8.0.x' |
| 97 | + |
| 98 | + - name: Build Linux |
| 99 | + run: dotnet publish -c Release -r linux-x64 --self-contained osu.Desktop/osu.Desktop.csproj -o publish/linux-x64 |
| 100 | + |
| 101 | + - name: Compress Linux Build |
| 102 | + run: zip -r osu-linux-x64.zip publish/linux-x64 |
| 103 | + |
| 104 | + - name: Upload Artifact |
| 105 | + uses: actions/upload-artifact@v4 |
| 106 | + with: |
| 107 | + name: osu-linux-x64 |
| 108 | + path: osu-linux-x64.zip |
| 109 | + |
| 110 | + build-ios: |
| 111 | + name: Build iOS |
| 112 | + runs-on: macos-15 |
| 113 | + continue-on-error: true |
| 114 | + steps: |
| 115 | + - name: Checkout |
| 116 | + uses: actions/checkout@v4 |
| 117 | + |
| 118 | + - name: Setup .NET |
| 119 | + uses: actions/setup-dotnet@v4 |
| 120 | + with: |
| 121 | + dotnet-version: '8.0.x' |
| 122 | + |
| 123 | + - name: Install iOS Workload |
| 124 | + run: dotnet workload install ios |
| 125 | + |
| 126 | + - name: Select Xcode |
| 127 | + run: sudo xcode-select -switch /Applications/Xcode_16.4.app |
| 128 | + |
| 129 | + - name: Build iOS |
| 130 | + run: dotnet publish -c Release -r ios-arm64 osu.iOS/osu.iOS.csproj /p:ArchiveOnBuild=true |
| 131 | + continue-on-error: true |
| 132 | + |
| 133 | + - name: Upload Artifact |
| 134 | + uses: actions/upload-artifact@v4 |
| 135 | + with: |
| 136 | + name: osu-ios |
| 137 | + path: | |
| 138 | + osu.iOS/bin/Release/net8.0-ios/ios-arm64/**/*.ipa |
| 139 | + osu.iOS/bin/Release/net8.0-ios/ios-arm64/**/*.app |
| 140 | +
|
| 141 | + release: |
| 142 | + name: Upload Release Assets |
| 143 | + needs: [build-android, build-windows, build-linux, build-ios] |
| 144 | + if: github.event_name == 'release' |
| 145 | + runs-on: ubuntu-latest |
| 146 | + steps: |
| 147 | + - name: Download artifacts |
| 148 | + uses: actions/download-artifact@v4 |
| 149 | + with: |
| 150 | + path: artifacts |
| 151 | + |
| 152 | + - name: Display structure of downloaded files |
| 153 | + run: ls -R artifacts |
| 154 | + |
| 155 | + - name: Upload to Release |
| 156 | + uses: softprops/action-gh-release@v1 |
| 157 | + with: |
| 158 | + files: | |
| 159 | + artifacts/osu-android/*.apk |
| 160 | + artifacts/osu-win-x64/*.zip |
| 161 | + artifacts/osu-linux-x64/*.zip |
| 162 | + artifacts/osu-ios/**/*.ipa |
0 commit comments