mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2025-12-28 19:34:30 +01:00
91 lines
3.7 KiB
YAML
91 lines
3.7 KiB
YAML
name: Publish Android Bindings
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
repository:
|
|
description: 'sdk repository, defaults to current repository'
|
|
required: false
|
|
type: string
|
|
ref:
|
|
description: 'commit/tag/branch reference'
|
|
required: true
|
|
type: string
|
|
package-version:
|
|
description: 'version for the gradle library (MAJOR.MINOR.BUILD)'
|
|
required: true
|
|
type: string
|
|
publish:
|
|
description: 'value indicating whether to publish to maven.'
|
|
required: true
|
|
type: boolean
|
|
default: false
|
|
secrets:
|
|
BREEZ_MVN_USERNAME:
|
|
description: 'username for gradlew publish'
|
|
required: true
|
|
BREEZ_MVN_PASSWORD:
|
|
description: 'password for gradlew publish'
|
|
required: true
|
|
|
|
jobs:
|
|
build-package:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout breez-liquid-sdk repo
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: ${{ inputs.repository || github.repository }}
|
|
ref: ${{ inputs.ref || github.sha }}
|
|
|
|
- uses: actions/setup-java@v3
|
|
with:
|
|
distribution: 'zulu'
|
|
java-version: '17'
|
|
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: bindings-android-jniLibs
|
|
path: lib/bindings/bindings-android/lib/src/main/jniLibs
|
|
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: bindings-kotlin
|
|
path: lib/bindings/bindings-android/lib/src/main/kotlin
|
|
|
|
- name: Build Android project
|
|
working-directory: lib/bindings/bindings-android
|
|
env:
|
|
ORG_GRADLE_PROJECT_libraryVersion: ${{ inputs.package-version || '0.0.1' }}
|
|
run: ./gradlew assemble
|
|
|
|
- name: Archive aar
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: android-release.aar
|
|
path: lib/bindings/bindings-android/lib/build/outputs/aar/lib-release.aar
|
|
|
|
- name: Publish artifacts
|
|
if: ${{ inputs.publish }}
|
|
working-directory: lib/bindings/bindings-android
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
BREEZ_MVN_USERNAME: ${{ secrets.BREEZ_MVN_USERNAME }}
|
|
BREEZ_MVN_PASSWORD: ${{ secrets.BREEZ_MVN_PASSWORD }}
|
|
run: |
|
|
./gradlew publish -PlibraryVersion=${{ inputs.package-version }} -PbreezReposiliteUsername="$BREEZ_MVN_USERNAME" -PbreezReposilitePassword="$BREEZ_MVN_PASSWORD"
|
|
|
|
- name: Trigger Jitpack build
|
|
if: ${{ inputs.publish }}
|
|
shell: bash
|
|
run: |
|
|
# Jitpack only makes artifacts avaiable when someone requests them.
|
|
# Here we trick Jitpack into thinking we're already requesting the newly built package
|
|
# to make sure it is available right away for anyone that needs it later.
|
|
# We're waiting for at most 60s before triggering the Jitpack build to give our Maven repo
|
|
# some time to process the just uploaded files (the Jitpack build is dependent upon them being available).
|
|
# If anything fails here, we'll still finish sucessfully as this is an optional optimization.
|
|
timeout 60 bash -c 'while [[ "$(curl --output /dev/null --silent --head --write-out ''%{http_code}'' https://mvn.breez.technology/releases/breez_liquid_sdk/bindings-android/${{ inputs.package-version }}/bindings-android-${{ inputs.package-version }}.pom)" != "200" ]]; do echo "Waiting for package to be published on mvn.breez.technology..." && sleep 5; done && echo "Package found."' || echo "Package not found." && true
|
|
echo "Attempting to trigger Jitpack build..."
|
|
curl -s -m 30 https://jitpack.io/api/builds/com.github.breez/breez-liquid-sdk/${{ inputs.package-version }} || true
|
|
echo "Done"
|