-
Notifications
You must be signed in to change notification settings - Fork 45
85 lines (78 loc) · 3.59 KB
/
publish-android.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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-sdk repo
uses: actions/checkout@v4
with:
repository: ${{ inputs.repository || github.repository }}
ref: ${{ inputs.ref || github.sha }}
- uses: actions/download-artifact@v4
with:
name: sdk-bindings-android-jniLibs
path: libs/sdk-bindings/bindings-android/lib/src/main/jniLibs
- uses: actions/download-artifact@v4
with:
name: bindings-kotlin
path: libs/sdk-bindings/bindings-android/lib/src/main/kotlin
- name: Build Android project
working-directory: libs/sdk-bindings/bindings-android
env:
ORG_GRADLE_PROJECT_libraryVersion: ${{ inputs.package-version || '0.0.1' }}
run: ./gradlew assemble
- name: Archive aar
uses: actions/upload-artifact@v4
with:
name: android-release.aar
path: libs/sdk-bindings/bindings-android/lib/build/outputs/aar/lib-release.aar
- name: Publish artifacts
if: ${{ inputs.publish }}
working-directory: libs/sdk-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_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-sdk/${{ inputs.package-version }} || true
echo "Done"