Add MIT License to the project #11
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
| # Release signing (optional): set repository secrets below. If ANDROID_KEYSTORE_BASE64 is unset, publish uses the debug keystore (e.g. PRs from forks). | |
| # ANDROID_KEYSTORE_BASE64 — Base64 of release.keystore (PowerShell: [Convert]::ToBase64String([IO.File]::ReadAllBytes("release.keystore"))) | |
| # ANDROID_SIGNING_STORE_PASS — keystore password | |
| # ANDROID_SIGNING_KEY_PASS — key password (often same as store) | |
| # ANDROID_SIGNING_KEY_ALIAS — optional; defaults to ringcontroller if empty | |
| name: build | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| dotnet-build: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: microsoft | |
| java-version: 17 | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Install Android workload | |
| run: dotnet workload install android | |
| # Native AOT Release: publish with RID (plain publish without -r can fail MSB3030 on RingController.so). | |
| - name: Publish (Release, android-arm64) | |
| shell: pwsh | |
| env: | |
| ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} | |
| ANDROID_SIGNING_STORE_PASS: ${{ secrets.ANDROID_SIGNING_STORE_PASS }} | |
| ANDROID_SIGNING_KEY_PASS: ${{ secrets.ANDROID_SIGNING_KEY_PASS }} | |
| ANDROID_SIGNING_KEY_ALIAS: ${{ secrets.ANDROID_SIGNING_KEY_ALIAS }} | |
| run: | | |
| $proj = "src/RingController/RingController.csproj" | |
| $args = @( | |
| "publish", $proj, | |
| "-c", "Release", | |
| "-f", "net10.0-android", | |
| "-r", "android-arm64" | |
| ) | |
| if ($env:ANDROID_KEYSTORE_BASE64) { | |
| $ksPath = Join-Path $env:GITHUB_WORKSPACE "src/RingController/release.keystore" | |
| $bytes = [Convert]::FromBase64String($env:ANDROID_KEYSTORE_BASE64) | |
| [IO.File]::WriteAllBytes($ksPath, $bytes) | |
| $alias = $env:ANDROID_SIGNING_KEY_ALIAS | |
| if ([string]::IsNullOrWhiteSpace($alias)) { $alias = "ringcontroller" } | |
| $args += @( | |
| "-p:AndroidKeyStore=true", | |
| "-p:AndroidSigningKeyStore=$ksPath", | |
| "-p:AndroidSigningStorePass=env:ANDROID_SIGNING_STORE_PASS", | |
| "-p:AndroidSigningKeyPass=env:ANDROID_SIGNING_KEY_PASS", | |
| "-p:AndroidSigningKeyAlias=$alias" | |
| ) | |
| Write-Host "Publishing with release keystore (alias: $alias)" | |
| } else { | |
| Write-Warning "ANDROID_KEYSTORE_BASE64 not set — publishing with default debug keystore" | |
| } | |
| dotnet @args | |
| - name: Resolve signed APK path | |
| id: signed_apk | |
| shell: pwsh | |
| run: | | |
| $base = "src/RingController/bin/Release/net10.0-android" | |
| $found = @(Get-ChildItem -Path $base -Recurse -Filter "com.cysharp.RingController-Signed.apk" -File -ErrorAction SilentlyContinue) | |
| if ($found.Count -eq 0) { throw "Signed APK not found under $base" } | |
| $pick = $found | Where-Object { $_.FullName -match '[\\/]publish[\\/]' } | Select-Object -First 1 | |
| if (-not $pick) { $pick = $found[0] } | |
| if ($found.Count -gt 1) { Write-Warning "Multiple APKs ($($found.Count)); uploading: $($pick.FullName)" } | |
| "apk_path=$($pick.FullName)" >> $env:GITHUB_OUTPUT | |
| - name: Upload signed APK | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| path: ${{ steps.signed_apk.outputs.apk_path }} | |
| archive: false | |
| if-no-files-found: error |