diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 543ecbf..08cd04e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: # build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/amd64, darwin/arm64 - goos: [linux, windows, darwin] + goos: [linux, windows, darwin, android] goarch: ["386", amd64, arm, arm64] exclude: - goos: darwin @@ -44,10 +44,11 @@ jobs: GOARCH: ${{ matrix.goarch }} IS_PR: ${{ !!github.head_ref }} run: | - if [ $GOOS = "windows" ]; then export BINARY_SUFFIX="$BINARY_SUFFIX.exe"; fi + if [ $GOOS == "windows" ]; then export BINARY_SUFFIX="$BINARY_SUFFIX.exe"; fi + if [ "$GOOS" == "android" ]; then declare -A goarch2cc=( ["arm64"]="aarch64-linux-android32-clang" ["arm"]="armv7a-linux-androideabi32-clang" ["amd64"]="x86_64-linux-android32-clang" ["386"]="i686-linux-android32-clang"); export CC="$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/${goarch2cc[$GOARCH]}"; fi if $IS_PR ; then echo $PR_PROMPT; fi export BINARY_NAME="$BINARY_PREFIX$GOOS_$GOARCH$BINARY_SUFFIX" - export CGO_ENABLED=0 + export CGO_ENABLED=$( [ "$GOOS" == "android" ] && echo 1 || echo 0 ) go build -o "output/$BINARY_NAME" -trimpath -ldflags "$LD_FLAGS" . - name: Upload artifact uses: actions/upload-artifact@v2