Skip to content

manually build ndk-pkg packages #1

manually build ndk-pkg packages

manually build ndk-pkg packages #1

name: manually build ndk-pkg packages
on:
workflow_dispatch:
inputs:
package-name:
description: input the package name to be built
required: true
default: zlib
target-api:
description: choose the min sdk api level to be built with
type: choice
options:
- '35'
- '34'
- '33'
- '32'
- '31'
- '30'
- '29'
- '28'
- '27'
- '26'
- '25'
- '24'
- '23'
- '22'
- '21'
target-abis:
description: input android abis to be built for
required: true
default: arm64-v8a,armeabi-v7a,x86_64,x86
build-type:
description: choose a build profile
type: choice
options:
- release
- debug
pack-type:
description: choose a pack type
type: choice
options:
- tar.xz
- tar.lz
- tar.gz
- tar.bz2
- zip
log-level:
description: choose a log-level
type: choice
options:
- ''
- '-q'
- '-v'
- '-vv'
static:
description: create fully statically linked executables
type: boolean
default: false
generate-maven-repo:
description: generate maven local repository bundle
type: boolean
default: false
maven-group-id:
description: input the maven groupId, default is com.fpliu.ndk.pkg.prefab.android.<API>
jobs:
build:
runs-on: ubuntu-latest
container: ubuntu:24.04
steps:
- run: apt -y update
- run: apt -y install curl
- run: curl -LO https://raw.githubusercontent.com/leleliu008/ndk-pkg/master/ndk-pkg
- run: chmod +x ndk-pkg
- run: ./ndk-pkg about
- run: ./ndk-pkg setup
- run: ./ndk-pkg sysinfo
- run: ./ndk-pkg update
- if: ${{ github.event.inputs.static == 'true' }}
run: ./ndk-pkg install android-${{ github.event.inputs.target-api }}-${{ github.event.inputs.target-abis }}/${{ github.event.inputs.package-name }} --profile=${{ github.event.inputs.build-type }} ${{ github.event.inputs.log-level }} --static
- if: ${{ github.event.inputs.static == 'false' }}
run: ./ndk-pkg install android-${{ github.event.inputs.target-api }}-${{ github.event.inputs.target-abis }}/${{ github.event.inputs.package-name }} --profile=${{ github.event.inputs.build-type }} ${{ github.event.inputs.log-level }}
- name: pack
run: |
set -ex
for item in $(./ndk-pkg ls-installed)
do
./ndk-pkg pack "$item" -t ${{ github.event.inputs.pack-type }}
done
- if: ${{ github.event.inputs.generate-maven-repo == 'true' }}
name: generate maven local repository
run: |
set -ex
export NDKPKG_XTRACE=1
GROUPID='${{ github.event.inputs.maven-group-id }}'
[ -z "$GROUPID" ] && GROUPID='com.fpliu.ndk.pkg.prefab.android.${{ github.event.inputs.target-api }}'
ABIS="${{ github.event.inputs.target-abis }}"
ABI="${ABIS%%,*}"
for PKGNAME in $(./ndk-pkg ls-installed | cut -d/ -f2 | sort | uniq)
do
if [ -d "$HOME/.ndk-pkg/installed/android-${{ github.event.inputs.target-api }}-$ABI/$PKGNAME/include" ] ; then
./ndk-pkg deploy android-${{ github.event.inputs.target-api }}-${{ github.event.inputs.target-abis }}/$PKGNAME --local=maven-local-repository-bundle --groupId="$GROUPID"
else
echo "no dev files."
fi
done
if [ -d maven-local-repository-bundle ] ; then
tar cJvf maven-local-repository-bundle.tar.xz maven-local-repository-bundle
fi
- run: ls
- run: du -sh *.tar.xz
- uses: actions/upload-artifact@v4
with:
name: ${{ github.event.inputs.package-name }}-android${{ github.event.inputs.target-api }}-${{ github.event.inputs.target-abis }}
path: ${{ github.workspace }}/*.tar.xz