Skip to content

Commit cd1a705

Browse files
authored
Update build.yml
1 parent a1c6f98 commit cd1a705

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
name: build-kopia-android
1+
name: build-and-release-kopia-android
2+
23
on:
34
workflow_dispatch:
45
inputs:
56
kopia-version:
6-
description: 'Kopia version (e.g. v0.21.1)'
7+
description: 'Kopia version tag (e.g. v0.21.1)'
78
required: true
89
default: 'v0.21.1'
910

@@ -22,39 +23,40 @@ jobs:
2223
with:
2324
go-version: '1.22.x'
2425

26+
# Install the Android NDK (r28c) and expose the path as output
2527
- id: ndk
2628
uses: nttld/setup-ndk@v1
2729
with:
2830
ndk-version: r28c
2931

30-
- name: Verify toolchain
31-
run: |
32-
echo "NDK path: ${{ steps.ndk.outputs.ndk-path }}"
33-
ls -l "${{ steps.ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin" | head
34-
test -x "${{ steps.ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
35-
36-
- name: Build Kopia (Android/arm64, CGO, netcgo) via go install
32+
- name: Build Kopia (Android/arm64, CGO, netcgo)
33+
env:
34+
NDK: ${{ steps.ndk.outputs.ndk-path }}
35+
KOPIA_VERSION: ${{ github.event.inputs.kopia-version }}
3736
run: |
38-
export NDK="${{ steps.ndk.outputs.ndk-path }}"
37+
set -e
38+
# ── Cross‑compiler paths ────────────────────────────────────────────
3939
export CC="$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
40-
export CXX="$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++"
40+
export CXX="$CC++"
41+
42+
# ── Go cross‑compile env ────────────────────────────────────────────
4143
export GOOS=android
4244
export GOARCH=arm64
4345
export CGO_ENABLED=1
4446
45-
# IMPORTANT: unset GOBIN for cross-installs
46-
env -u GOBIN go install -tags netcgo github.com/kopia/kopia@${{ github.event.inputs.kopia-version }}
47+
# Unset GOBIN so go install accepts cross‑install
48+
env -u GOBIN go install -tags netcgo github.com/kopia/kopia@${KOPIA_VERSION}
4749
4850
BIN_DIR="$(go env GOPATH)/bin/${GOOS}_${GOARCH}"
4951
mkdir -p dist
5052
cp "$BIN_DIR/kopia" dist/kopia-android-arm64
51-
(cd dist && sha256sum kopia-android-arm64 > kopia-android-arm64.sha256)
53+
( cd dist && sha256sum kopia-android-arm64 > kopia-android-arm64.sha256 )
5254
5355
- name: Upload artifact
5456
uses: actions/upload-artifact@v4
5557
with:
56-
name: kopia-android # <-- artifact name consumed by next job
57-
path: dist/*
58+
name: kopia-android-artifact
59+
path: dist/
5860

5961
release:
6062
needs: build

0 commit comments

Comments
 (0)