Android CI #55
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Android CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: ["main"] | |
release: | |
types: ["published"] | |
jobs: | |
build: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
env: | |
CGO_ENABLED: 0 | |
steps: | |
- name: Checkout codebase | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.22" | |
check-latest: true | |
# Set up JDK | |
- name: Set Up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: "17" | |
distribution: "zulu" | |
cache: "gradle" | |
- name: Install NDK | |
uses: nttld/setup-ndk@v1 | |
with: | |
ndk-version: r26b | |
link-to-sdk: true | |
- name: Install Gomobile and Build native parts | |
run: | | |
for d in $ANDROID_NDK_HOME/../26*; do | |
ANDROID_NDK_HOME=$d | |
done | |
cd app/libs | |
go run golang.org/x/mobile/cmd/gomobile init | |
go run golang.org/x/mobile/cmd/gomobile bind -ldflags="-w -s" -target=android -androidapi=21 -o=tun2socks.aar . | |
cd ../.. | |
- name: Change wrapper permissions | |
run: chmod +x ./gradlew | |
# Run Build Project | |
- name: Build gradle project | |
run: ./gradlew build | |
# Build APKs | |
- name: Build Release APK | |
run: | | |
./gradlew assembleRelease | |
# Upload build aar to Artifacts | |
- name: Upload build aar to Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "tun2socks" | |
path: app/libs/*.aar | |
# Upload APK artifact | |
- name: Upload files to Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: oblivion-${{ github.sha }}-unsigned.apk | |
path: | | |
app/build/outputs/apk/release/*.apk |