Release Build #28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| workflow_dispatch: | |
| release: | |
| types: [published] | |
| jobs: | |
| prepare-release: | |
| name: Prepare Release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.get_version.outputs.version }} | |
| tag: ${{ steps.get_version.outputs.tag }} | |
| steps: | |
| - name: Get Version | |
| id: get_version | |
| run: | | |
| DATE=$(date +'%Y.%-m%d.0') | |
| echo "version=$DATE" >> $GITHUB_OUTPUT | |
| echo "tag=$DATE" >> $GITHUB_OUTPUT | |
| build-android: | |
| name: Build Android | |
| needs: prepare-release | |
| runs-on: windows-latest | |
| env: | |
| ANDROID_KEYSTORE_FILE: ${{ secrets.ANDROID_KEYSTORE_FILE }} | |
| ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} | |
| ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} | |
| ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'microsoft' | |
| java-version: '11' | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| cache: false | |
| - name: Install Android Workload | |
| run: dotnet workload install android wasi-experimental | |
| - name: Setup NDK | |
| uses: nttld/setup-ndk@v1 | |
| with: | |
| ndk-version: r28 | |
| - name: Install Ninja | |
| run: choco install ninja | |
| - name: Build Android Native Libraries | |
| run: osu.Android/Native/build_native.ps1 | |
| shell: pwsh | |
| - name: Decode Keystore | |
| if: env.ANDROID_KEYSTORE_FILE != '' | |
| run: | | |
| $bytes = [System.Convert]::FromBase64String($env:ANDROID_KEYSTORE_FILE) | |
| [System.IO.File]::WriteAllBytes("keystore.jks", $bytes) | |
| shell: pwsh | |
| - name: Build Android (Signed) | |
| if: env.ANDROID_KEYSTORE_FILE != '' | |
| run: > | |
| dotnet publish -c Release -f net8.0-android osu.Android/osu.Android.csproj | |
| -p:AndroidKeyStore=true | |
| -p:AndroidSigningKeyStore=keystore.jks | |
| -p:AndroidSigningStorePass="$env:ANDROID_KEYSTORE_PASSWORD" | |
| -p:AndroidSigningKeyAlias="$env:ANDROID_KEY_ALIAS" | |
| -p:AndroidSigningKeyPass="$env:ANDROID_KEY_PASSWORD" | |
| -p:Version=${{ needs.prepare-release.outputs.version }} | |
| - name: Build Android (Unsigned) | |
| if: env.ANDROID_KEYSTORE_FILE == '' | |
| run: dotnet publish -c Release -f net8.0-android osu.Android/osu.Android.csproj -p:Version=${{ needs.prepare-release.outputs.version }} | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: osu-android | |
| path: osu.Android/bin/Release/net8.0-android/*.apk | |
| build-windows: | |
| name: Build Windows | |
| needs: prepare-release | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| cache: true | |
| cache-dependency-path: '**/packages.lock.json' | |
| - name: Build Windows | |
| run: dotnet publish -c Release -r win-x64 --self-contained osu.Desktop/osu.Desktop.csproj -o publish/win-x64 -p:PublishReadyToRun=true -p:Version=${{ needs.prepare-release.outputs.version }} | |
| - name: Compress Windows Build | |
| run: Compress-Archive -Path publish/win-x64/* -DestinationPath osu-win-x64.zip | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: osu-win-x64 | |
| path: osu-win-x64.zip | |
| build-linux: | |
| name: Build Linux | |
| needs: prepare-release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| cache: true | |
| cache-dependency-path: '**/packages.lock.json' | |
| - name: Build Linux | |
| run: dotnet publish -c Release -r linux-x64 --self-contained osu.Desktop/osu.Desktop.csproj -o publish/linux-x64 -p:PublishReadyToRun=true -p:Version=${{ needs.prepare-release.outputs.version }} | |
| - name: Compress Linux Build | |
| run: zip -r osu-linux-x64.zip publish/linux-x64 | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: osu-linux-x64 | |
| path: osu-linux-x64.zip | |
| build-ios: | |
| name: Build iOS | |
| needs: prepare-release | |
| runs-on: macos-14 | |
| env: | |
| IOS_CERTIFICATE: ${{ secrets.IOS_CERTIFICATE }} | |
| IOS_CERTIFICATE_PASSWORD: ${{ secrets.IOS_CERTIFICATE_PASSWORD }} | |
| IOS_PROVISION_PROFILE: ${{ secrets.IOS_PROVISION_PROFILE }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| cache: true | |
| cache-dependency-path: '**/packages.lock.json' | |
| - name: Install iOS Workload | |
| run: dotnet workload install ios | |
| - name: Import Certificate and Provisioning Profile | |
| if: env.IOS_CERTIFICATE != '' | |
| run: | | |
| # Create variables | |
| CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | |
| PP_PATH=$RUNNER_TEMP/build_profile.mobileprovision | |
| KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | |
| # Import certificate and provisioning profile from secrets | |
| echo -n "$IOS_CERTIFICATE" | base64 --decode -o $CERTIFICATE_PATH | |
| echo -n "$IOS_PROVISION_PROFILE" | base64 --decode -o $PP_PATH | |
| # Create temporary keychain | |
| security create-keychain -p "" $KEYCHAIN_PATH | |
| security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | |
| security unlock-keychain -p "" $KEYCHAIN_PATH | |
| # Import certificate to keychain | |
| security import $CERTIFICATE_PATH -P "$IOS_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | |
| security list-keychain -d user -s $KEYCHAIN_PATH | |
| # Apply provisioning profile | |
| mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | |
| cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles/ | |
| - name: Build iOS (Signed) | |
| if: env.IOS_CERTIFICATE != '' | |
| run: dotnet publish -c Release -r ios-arm64 osu.iOS/osu.iOS.csproj -p:ArchiveOnBuild=true -p:Version=${{ needs.prepare-release.outputs.version }} | |
| - name: Build iOS (Unsigned) | |
| if: env.IOS_CERTIFICATE == '' | |
| run: dotnet publish -c Release -r ios-arm64 osu.iOS/osu.iOS.csproj -p:ArchiveOnBuild=false -p:Version=${{ needs.prepare-release.outputs.version }} | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: osu-ios | |
| path: | | |
| osu.iOS/bin/Release/net8.0-ios/ios-arm64/**/*.ipa | |
| osu.iOS/bin/Release/net8.0-ios/ios-arm64/**/*.app | |
| release: | |
| name: Upload Release Assets | |
| needs: [prepare-release, build-android, build-windows, build-linux, build-ios] | |
| if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Display structure of downloaded files | |
| run: ls -R artifacts | |
| - name: Upload to Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ github.event_name == 'workflow_dispatch' && needs.prepare-release.outputs.tag || github.ref_name }} | |
| generate_release_notes: true | |
| files: | | |
| artifacts/osu-android/*.apk | |
| artifacts/osu-win-x64/*.zip | |
| artifacts/osu-linux-x64/*.zip | |
| artifacts/osu-ios/**/*.ipa |