Skip to content

v0.3.4

v0.3.4 #71

Workflow file for this run

# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more info see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
name: Gradle Package
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: "Version to publish (e.g., v0.1.0)"
required: true
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.version || github.event.release.tag_name }}
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Install native build dependencies
run: sudo apt-get update && sudo apt-get install -y libdbus-1-dev 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: Extract version from input or tag
id: version
shell: bash
run: |
VERSION="${{ inputs.version }}"
if [[ -z "$VERSION" ]]; then
VERSION="$GITHUB_REF_NAME"
fi
echo "version=${VERSION#v}" >> "$GITHUB_OUTPUT"
- name: Generate Android bindings
run: ./build_android.sh
- name: Build with Gradle
working-directory: bindings/android
run: ./gradlew build -Pversion=${{ steps.version.outputs.version }}
- name: Upload native debug symbols artifact
uses: actions/upload-artifact@v4
with:
name: bitkit-core-native-debug-symbols-${{ steps.version.outputs.version }}
path: bindings/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/android/native-debug-symbols.zip --clobber
# same credentials env vars used in the publishing section of build.gradle.kts
- name: Publish to GitHub Packages
working-directory: bindings/android
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
GITHUB_REPO: ${{ github.repository }}
run: ./gradlew publish -Pversion=${{ steps.version.outputs.version }}