Skip to content

Commit 4ac1421

Browse files
xaionaro@dx.centerxaionaro@dx.center
authored andcommitted
ci: add release job that builds ndkcli for arm64 and x86_64
Triggers on version tags (v*). Builds stripped Android binaries for both architectures, then creates a GitHub release with the binaries attached. Depends on test and check-examples jobs passing first.
1 parent 23b1ff7 commit 4ac1421

1 file changed

Lines changed: 48 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ name: CI
33
on:
44
push:
55
branches: [main]
6+
tags: ['v*']
67
pull_request:
78
branches: [main]
89
workflow_dispatch:
910

1011
permissions:
11-
contents: read
12+
contents: write
1213

1314
env:
1415
ANDROID_NDK_VERSION: r28
@@ -88,3 +89,49 @@ jobs:
8889
target: google_apis
8990
arch: x86_64
9091
script: make e2e-examples
92+
93+
release:
94+
name: Release ndkcli
95+
runs-on: ubuntu-latest
96+
needs: [test, check-examples]
97+
if: startsWith(github.ref, 'refs/tags/v')
98+
steps:
99+
- uses: actions/checkout@v4
100+
101+
- uses: actions/setup-go@v5
102+
with:
103+
go-version: "1.24"
104+
105+
- name: Install Android NDK
106+
run: |
107+
wget -q "https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux.zip" -O /tmp/ndk.zip
108+
unzip -q /tmp/ndk.zip -d /tmp/ndk-extract/
109+
mkdir -p "$ANDROID_HOME/ndk"
110+
mv /tmp/ndk-extract/android-ndk-* "$ANDROID_HOME/ndk/${ANDROID_NDK_DIR_NAME}"
111+
echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/${ANDROID_NDK_DIR_NAME}" >> "$GITHUB_ENV"
112+
echo "NDK_CC_PREFIX=$ANDROID_HOME/ndk/${ANDROID_NDK_DIR_NAME}/toolchains/llvm/prebuilt/linux-x86_64/bin" >> "$GITHUB_ENV"
113+
114+
- name: Build ndkcli for arm64
115+
run: |
116+
CGO_ENABLED=1 GOOS=android GOARCH=arm64 \
117+
CC="${NDK_CC_PREFIX}/aarch64-linux-android35-clang" \
118+
go build -trimpath -ldflags="-s -w" \
119+
-o ndkcli-android-arm64 ./cmd/ndkcli/
120+
121+
- name: Build ndkcli for x86_64
122+
run: |
123+
CGO_ENABLED=1 GOOS=android GOARCH=amd64 \
124+
CC="${NDK_CC_PREFIX}/x86_64-linux-android35-clang" \
125+
go build -trimpath -ldflags="-s -w" \
126+
-o ndkcli-android-x86_64 ./cmd/ndkcli/
127+
128+
- name: Create release
129+
env:
130+
GH_TOKEN: ${{ github.token }}
131+
TAG_NAME: ${{ github.ref_name }}
132+
run: |
133+
gh release create "$TAG_NAME" \
134+
--title "ndkcli $TAG_NAME" \
135+
--generate-notes \
136+
ndkcli-android-arm64 \
137+
ndkcli-android-x86_64

0 commit comments

Comments
 (0)