Skip to content

Commit 84a48fe

Browse files
author
Jurvis Tan
committed
GHA action to publish ldk-node-jvm
1 parent 120b444 commit 84a48fe

1 file changed

Lines changed: 86 additions & 0 deletions

File tree

.github/workflows/publish-jvm.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Publish ldk-node-jvm to Maven Central
2+
on: [workflow_dispatch]
3+
4+
jobs:
5+
build-jvm-macOS-M1-native-lib:
6+
name: "Create M1 and x86_64 JVM native binaries"
7+
runs-on: macos-12
8+
steps:
9+
- name: "Checkout publishing branch"
10+
uses: actions/checkout@v2
11+
12+
- name: Cache
13+
uses: actions/cache@v3
14+
with:
15+
path: |
16+
~/.cargo/registry
17+
~/.cargo/git
18+
./target
19+
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
20+
21+
- name: Set up JDK
22+
uses: actions/setup-java@v2
23+
with:
24+
distribution: temurin
25+
java-version: 11
26+
27+
- name: Install aarch64 Rust target
28+
run: rustup target add aarch64-apple-darwin
29+
30+
- name: Build ldk-node-jvm library
31+
run: |
32+
./scripts/uniffi_bindgen_generate_kotlin.sh
33+
34+
# build aarch64 + x86_64 native libraries and upload
35+
- name: Upload macOS native libraries for reuse in publishing job
36+
uses: actions/upload-artifact@v3
37+
with:
38+
# name: no name is required because we upload the entire directory
39+
# the default name "artifact" will be used
40+
path: /Users/runner/work/ldk-node/ldk-node/bindings/kotlin/ldk-node-jvm/lib/src/main/resources/
41+
42+
build-jvm-full-library:
43+
name: "Create full ldk-node-jvm library"
44+
needs: [build-jvm-macOS-M1-native-lib]
45+
runs-on: ubuntu-20.04
46+
steps:
47+
- name: "Check out PR branch"
48+
uses: actions/checkout@v2
49+
50+
- name: "Cache"
51+
uses: actions/cache@v2
52+
with:
53+
path: |
54+
~/.cargo/registry
55+
~/.cargo/git
56+
./target
57+
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
58+
59+
- name: "Set up JDK"
60+
uses: actions/setup-java@v2
61+
with:
62+
distribution: temurin
63+
java-version: 11
64+
65+
- name: "Build ldk-node-jvm library"
66+
run: |
67+
./scripts/uniffi_bindgen_generate_kotlin.sh
68+
69+
- name: Download macOS native libraries from previous job
70+
uses: actions/download-artifact@v3
71+
id: download
72+
with:
73+
# download the artifact created in the prior job (named "artifact")
74+
name: artifact
75+
path: ./bindings/kotlin/ldk-node-jvm/lib/src/main/resources/
76+
77+
- name: "Publish to Maven Local and Maven Central"
78+
env:
79+
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.PGP_KEY_ID }}
80+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SECRET_KEY }}
81+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PGP_PASSPHRASE }}
82+
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.NEXUS_USERNAME }}
83+
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.NEXUS_PASSWORD }}
84+
run: |
85+
cd bindings/kotlin/ldk-node-jvm
86+
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository

0 commit comments

Comments
 (0)