Add Android in-app update flow #4
Workflow file for this run
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: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: Release tag, for example v0.1.0 | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| jobs: | |
| android: | |
| name: Build Android APK | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "17" | |
| - name: Set up Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Install Android build packages | |
| run: sdkmanager "platforms;android-35" "build-tools;35.0.0" "cmake;3.22.1" "ndk;27.0.12077973" | |
| - name: Check Android signing inputs | |
| id: signing | |
| env: | |
| OPENSTREAM_RELEASE_KEYSTORE_BASE64: ${{ secrets.OPENSTREAM_RELEASE_KEYSTORE_BASE64 }} | |
| OPENSTREAM_RELEASE_STORE_PASSWORD: ${{ secrets.OPENSTREAM_RELEASE_STORE_PASSWORD }} | |
| OPENSTREAM_RELEASE_KEY_ALIAS: ${{ secrets.OPENSTREAM_RELEASE_KEY_ALIAS }} | |
| OPENSTREAM_RELEASE_KEY_PASSWORD: ${{ secrets.OPENSTREAM_RELEASE_KEY_PASSWORD }} | |
| run: | | |
| if [ -n "$OPENSTREAM_RELEASE_KEYSTORE_BASE64" ] && | |
| [ -n "$OPENSTREAM_RELEASE_STORE_PASSWORD" ] && | |
| [ -n "$OPENSTREAM_RELEASE_KEY_ALIAS" ] && | |
| [ -n "$OPENSTREAM_RELEASE_KEY_PASSWORD" ]; then | |
| echo "has_signing=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "has_signing=false" >> "$GITHUB_OUTPUT" | |
| echo "::warning::Android release signing secrets are incomplete; publishing debug-signed beta APK." | |
| fi | |
| - name: Decode Android signing key | |
| if: steps.signing.outputs.has_signing == 'true' | |
| env: | |
| OPENSTREAM_RELEASE_KEYSTORE_BASE64: ${{ secrets.OPENSTREAM_RELEASE_KEYSTORE_BASE64 }} | |
| run: | | |
| printf '%s' "$OPENSTREAM_RELEASE_KEYSTORE_BASE64" | base64 --decode > android/app/openstream-release.keystore | |
| - name: Build signed release APK with native SRT enabled | |
| if: steps.signing.outputs.has_signing == 'true' | |
| working-directory: android | |
| env: | |
| OPENSTREAM_RELEASE_KEYSTORE: ${{ github.workspace }}/android/app/openstream-release.keystore | |
| OPENSTREAM_RELEASE_STORE_PASSWORD: ${{ secrets.OPENSTREAM_RELEASE_STORE_PASSWORD }} | |
| OPENSTREAM_RELEASE_KEY_ALIAS: ${{ secrets.OPENSTREAM_RELEASE_KEY_ALIAS }} | |
| OPENSTREAM_RELEASE_KEY_PASSWORD: ${{ secrets.OPENSTREAM_RELEASE_KEY_PASSWORD }} | |
| OPENSTREAM_VERSION_NAME: ${{ inputs.tag || github.ref_name }} | |
| OPENSTREAM_VERSION_CODE: ${{ github.run_number }} | |
| run: | | |
| chmod +x ./gradlew | |
| ./gradlew --no-daemon :app:assembleRelease | |
| - name: Build debug-signed beta APK with native SRT enabled | |
| if: steps.signing.outputs.has_signing != 'true' | |
| working-directory: android | |
| env: | |
| OPENSTREAM_VERSION_NAME: ${{ inputs.tag || github.ref_name }} | |
| OPENSTREAM_VERSION_CODE: ${{ github.run_number }} | |
| run: | | |
| chmod +x ./gradlew | |
| ./gradlew --no-daemon :app:assembleDebug | |
| - name: Normalize Android APK artifact | |
| run: | | |
| mkdir -p dist | |
| if [ -f android/app/build/outputs/apk/release/app-release.apk ]; then | |
| cp android/app/build/outputs/apk/release/app-release.apk dist/openstream-android.apk | |
| printf 'signed-release\n' > dist/android-signing.txt | |
| else | |
| cp android/app/build/outputs/apk/debug/app-debug.apk dist/openstream-android.apk | |
| printf 'debug-signed-beta\n' > dist/android-signing.txt | |
| fi | |
| VERSION_NAME="${{ inputs.tag || github.ref_name }}" | |
| VERSION_NAME="${VERSION_NAME#v}" | |
| printf '{\n "versionName": "%s",\n "versionCode": %s,\n "apkAsset": "openstream-android.apk"\n}\n' \ | |
| "$VERSION_NAME" \ | |
| "${{ github.run_number }}" \ | |
| > dist/openstream-android-update.json | |
| - name: Upload APK artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: openstream-android-apk | |
| path: | | |
| dist/openstream-android.apk | |
| dist/android-signing.txt | |
| dist/openstream-android-update.json | |
| if-no-files-found: error | |
| obs-plugin: | |
| name: Build OBS plugin | |
| runs-on: windows-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Install OBS Studio | |
| shell: powershell | |
| run: choco install obs-studio -y --no-progress | |
| - name: Build plugin package | |
| shell: cmd | |
| run: | | |
| set OPENSTREAM_SKIP_INSTALL=1 | |
| set OPENSTREAM_PLUGIN_PACKAGE_DIR=%CD%\artifacts | |
| call build_plugin.bat | |
| - name: Install Inno Setup | |
| shell: powershell | |
| run: choco install innosetup -y --no-progress | |
| - name: Build plugin installer | |
| shell: powershell | |
| env: | |
| OPENSTREAM_VERSION: ${{ inputs.tag || github.ref_name }} | |
| run: | | |
| if (-not $env:OPENSTREAM_VERSION) { | |
| $env:OPENSTREAM_VERSION = "manual" | |
| } | |
| $iscc = "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe" | |
| & $iscc "tools\installer\openstream-obs-plugin.iss" ` | |
| "/DPluginDll=$PWD\obs-plugin\build\openstream-obs.dll" ` | |
| "/DOutputDir=$PWD\artifacts" ` | |
| "/DOutputBaseFilename=openstream-obs-plugin-installer-windows-x64" ` | |
| "/DOpenStreamVersion=$env:OPENSTREAM_VERSION" | |
| - name: Upload plugin artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: openstream-obs-windows-x64 | |
| path: | | |
| artifacts/openstream-obs-windows-x64.zip | |
| artifacts/openstream-obs-plugin-installer-windows-x64.exe | |
| if-no-files-found: error | |
| publish: | |
| name: Publish GitHub release | |
| runs-on: ubuntu-latest | |
| needs: [android, obs-plugin] | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Verify release assets | |
| run: | | |
| test -f dist/openstream-android.apk | |
| test -f dist/openstream-android-update.json | |
| test -f dist/openstream-obs-plugin-installer-windows-x64.exe | |
| test -f dist/openstream-obs-windows-x64.zip | |
| - name: Create release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| INPUT_TAG: ${{ inputs.tag }} | |
| run: | | |
| TAG_NAME="${INPUT_TAG:-${GITHUB_REF_NAME}}" | |
| gh release create "$TAG_NAME" \ | |
| dist/openstream-android.apk \ | |
| dist/openstream-android-update.json \ | |
| dist/openstream-obs-plugin-installer-windows-x64.exe \ | |
| dist/openstream-obs-windows-x64.zip \ | |
| --target "$GITHUB_SHA" \ | |
| --title "OpenStream ${TAG_NAME}" \ | |
| --notes-file docs/release-notes-template.md | |