Skip to content

Commit 796729b

Browse files
xaionaro@dx.centerxaionaro@dx.center
authored andcommitted
ci: add release workflow for jnictl + jniservice artifacts
Triggered on version tags (v*). Builds for both arm64 and x86_64: - jnictl-linux-{arch}: CLI binary for Linux - jnictl-android-{arch}: CLI binary for Android - libjniservice-{abi}.so: gRPC server shared library - classes.dex: Java wrapper for app_process execution Artifacts are attached to the GitHub release with auto-generated release notes.
1 parent c4dd1e6 commit 796729b

1 file changed

Lines changed: 107 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
name: Build release artifacts
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
include:
18+
- goarch: arm64
19+
android_abi: arm64-v8a
20+
ndk_triple: aarch64-linux-android
21+
- goarch: amd64
22+
android_abi: x86_64
23+
ndk_triple: x86_64-linux-android
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- uses: actions/setup-go@v5
29+
with:
30+
go-version: '1.24'
31+
cache: true
32+
33+
- name: Set up JDK 17
34+
uses: actions/setup-java@v4
35+
with:
36+
distribution: temurin
37+
java-version: '17'
38+
39+
- name: Set up Android SDK
40+
uses: android-actions/setup-android@v3
41+
42+
- name: Install Android NDK and build-tools
43+
run: sdkmanager --install "ndk;27.0.12077973" "build-tools;35.0.0" "platforms;android-35"
44+
45+
- name: Build jnictl (linux)
46+
env:
47+
CGO_ENABLED: '0'
48+
GOOS: linux
49+
GOARCH: ${{ matrix.goarch }}
50+
run: go build -o dist/jnictl-linux-${{ matrix.goarch }} ./cmd/jnictl/
51+
52+
- name: Build jnictl (android)
53+
env:
54+
CGO_ENABLED: '0'
55+
GOOS: android
56+
GOARCH: ${{ matrix.goarch }}
57+
run: go build -o dist/jnictl-android-${{ matrix.goarch }} ./cmd/jnictl/
58+
59+
- name: Build jniservice shared library
60+
env:
61+
CGO_ENABLED: '1'
62+
GOOS: android
63+
GOARCH: ${{ matrix.goarch }}
64+
NDK_HOME: /usr/local/lib/android/sdk/ndk/27.0.12077973
65+
CC_TRIPLE: ${{ matrix.ndk_triple }}
66+
run: |
67+
CC=$NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/${CC_TRIPLE}30-clang \
68+
go build -buildmode=c-shared \
69+
-o dist/libjniservice-${{ matrix.android_abi }}.so \
70+
./cmd/jniservice/
71+
72+
- name: Compile Java wrapper and create classes.dex
73+
env:
74+
ANDROID_SDK_ROOT: /usr/local/lib/android/sdk
75+
run: |
76+
javac --release 17 -d dist cmd/jniservice/JNIService.java
77+
$ANDROID_SDK_ROOT/build-tools/35.0.0/d8 \
78+
--lib $ANDROID_SDK_ROOT/platforms/android-35/android.jar \
79+
--output dist dist/JNIService.class
80+
rm -f dist/JNIService.class
81+
82+
- name: Upload artifacts
83+
uses: actions/upload-artifact@v4
84+
with:
85+
name: release-${{ matrix.goarch }}
86+
path: dist/
87+
88+
release:
89+
name: Create GitHub release
90+
needs: build
91+
runs-on: ubuntu-latest
92+
steps:
93+
- name: Download all artifacts
94+
uses: actions/download-artifact@v4
95+
with:
96+
path: artifacts
97+
merge-multiple: true
98+
99+
- name: List artifacts
100+
run: find artifacts -type f | sort
101+
102+
- name: Create release
103+
uses: softprops/action-gh-release@v2
104+
with:
105+
generate_release_notes: true
106+
files: |
107+
artifacts/**/*

0 commit comments

Comments
 (0)