Android Publish #40
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: Android Publish | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version/tag to publish (e.g., v0.7.0-rc.50 or 0.7.0-rc.50)" | |
| required: true | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Normalize release version | |
| id: version | |
| shell: bash | |
| run: | | |
| VERSION="${{ github.event.inputs.version || github.event.release.tag_name || github.ref_name }}" | |
| TAG="$VERSION" | |
| if [[ "$TAG" != v* ]]; then | |
| TAG="v$TAG" | |
| fi | |
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | |
| echo "version=${TAG#v}" >> "$GITHUB_OUTPUT" | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ steps.version.outputs.tag }} | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| server-id: github | |
| settings-path: ${{ github.workspace }} | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Install native build dependencies | |
| run: sudo apt-get update && sudo apt-get install -y pkg-config protobuf-compiler | |
| - name: Set up Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Set up Android NDK | |
| id: setup-ndk | |
| uses: nttld/setup-ndk@v1 | |
| with: | |
| ndk-version: r28c | |
| add-to-path: true | |
| - name: Export Android NDK root | |
| run: echo "ANDROID_NDK_ROOT=${{ steps.setup-ndk.outputs.ndk-path }}" >> "$GITHUB_ENV" | |
| - name: Generate Android bindings | |
| run: scripts/uniffi_bindgen_generate_kotlin_android.sh | |
| - name: Build with Gradle | |
| working-directory: bindings/kotlin/ldk-node-android | |
| run: ./gradlew build -Pversion=${{ steps.version.outputs.version }} | |
| - name: Upload native debug symbols artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ldk-node-native-debug-symbols-${{ steps.version.outputs.version }} | |
| path: bindings/kotlin/ldk-node-android/native-debug-symbols.zip | |
| - name: Upload native debug symbols to release | |
| if: github.event_name == 'release' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: gh release upload "${{ github.event.release.tag_name }}" bindings/kotlin/ldk-node-android/native-debug-symbols.zip --clobber | |
| - name: Publish to GitHub Packages | |
| working-directory: bindings/kotlin/ldk-node-android | |
| env: | |
| GITHUB_ACTOR: ${{ github.actor }} | |
| GITHUB_TOKEN: ${{ github.token }} | |
| GITHUB_REPO: ${{ github.repository }} | |
| run: ./gradlew publish -Pversion=${{ steps.version.outputs.version }} |