Skip to content

Commit 0b36d76

Browse files
committed
ci: add release workflow for Android AAR and sample APK
1 parent 1d5e7de commit 0b36d76

1 file changed

Lines changed: 109 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Triggers on tags like v0.1.0, v1.0.0
7+
workflow_dispatch: # Allow manual trigger
8+
inputs:
9+
version:
10+
description: 'Version to release (e.g., 0.1.0)'
11+
required: true
12+
type: string
13+
14+
jobs:
15+
release:
16+
name: Build and Release
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
submodules: recursive
24+
25+
- name: Set up JDK 17
26+
uses: actions/setup-java@v4
27+
with:
28+
java-version: '17'
29+
distribution: 'temurin'
30+
31+
- name: Setup Android SDK
32+
uses: android-actions/setup-android@v3
33+
34+
- name: Setup Gradle
35+
uses: gradle/actions/setup-gradle@v3
36+
37+
- name: Determine version
38+
id: version
39+
run: |
40+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
41+
VERSION="${{ github.event.inputs.version }}"
42+
else
43+
VERSION="${GITHUB_REF#refs/tags/v}"
44+
fi
45+
echo "version=$VERSION" >> $GITHUB_OUTPUT
46+
echo "Version: $VERSION"
47+
48+
- name: Build Release AAR
49+
run: ./gradlew :app:assembleRelease
50+
51+
- name: Build Sample APK
52+
run: ./gradlew :sample:assembleRelease
53+
54+
- name: Create Release Notes
55+
id: release_notes
56+
run: |
57+
cat << EOF > release_notes.md
58+
## LLaMA Kotlin Android v${{ steps.version.outputs.version }}
59+
60+
### Installation
61+
62+
Add to your \`build.gradle.kts\`:
63+
64+
\`\`\`kotlin
65+
dependencies {
66+
implementation("org.codeshipping:llama-kotlin-android:${{ steps.version.outputs.version }}")
67+
}
68+
\`\`\`
69+
70+
### Artifacts
71+
72+
- **llama-kotlin-android-${{ steps.version.outputs.version }}.aar** - The main library
73+
- **sample-release.apk** - Sample application demonstrating usage
74+
75+
### What's Included
76+
77+
- Kotlin-first API for LLaMA inference
78+
- Native llama.cpp backend
79+
- Support for arm64-v8a and x86_64
80+
- Coroutine-based streaming generation
81+
82+
### Maven Central
83+
84+
This release is also available on [Maven Central](https://central.sonatype.com/artifact/org.codeshipping/llama-kotlin-android/${{ steps.version.outputs.version }})
85+
EOF
86+
87+
- name: Create GitHub Release
88+
uses: softprops/action-gh-release@v1
89+
with:
90+
name: v${{ steps.version.outputs.version }}
91+
tag_name: v${{ steps.version.outputs.version }}
92+
body_path: release_notes.md
93+
draft: false
94+
prerelease: false
95+
files: |
96+
app/build/outputs/aar/app-release.aar
97+
sample/build/outputs/apk/release/sample-release-unsigned.apk
98+
env:
99+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100+
101+
- name: Summary
102+
run: |
103+
echo "### Release Created! 🎉" >> $GITHUB_STEP_SUMMARY
104+
echo "" >> $GITHUB_STEP_SUMMARY
105+
echo "**Version:** v${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
106+
echo "" >> $GITHUB_STEP_SUMMARY
107+
echo "**Artifacts:**" >> $GITHUB_STEP_SUMMARY
108+
echo "- Library AAR" >> $GITHUB_STEP_SUMMARY
109+
echo "- Sample APK" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)