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: Build and Release AAR | |
on: | |
workflow_dispatch: | |
inputs: | |
release_tag: | |
description: 'The release tag to associate with the build' | |
required: true | |
type: string | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Golang | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: 'go.mod' | |
- name: Setup JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
- name: Setup Android SDK Tools | |
uses: android-actions/[email protected] | |
with: | |
cmdline-tools-version: 10406996 | |
- name: Setup Android NDK | |
uses: nttld/[email protected] | |
with: | |
ndk-version: 'r26b' | |
link-to-sdk: true | |
- name: Install Go Mobile and Initialize | |
run: | | |
go install golang.org/x/mobile/cmd/gomobile@latest | |
go install golang.org/x/mobile/cmd/gobind@latest | |
export PATH=$PATH:~/go/bin | |
gomobile init | |
- name: Prepare Go Modules | |
run: | | |
go get | |
go mod tidy -v | |
go get golang.org/x/mobile/bind | |
- name: Build AAR | |
run: | | |
gomobile bind -v -androidapi 21 -ldflags='-s -w' -o libSocksLite.aar ./pkg/socks | |
- name: Create Release and Upload AAR | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file: libSocksLite.aar | |
tag: ${{ github.event.inputs.release_tag }} | |
file_glob: false |