Skip to content

update

update #21

Workflow file for this run

name: release-apk
on: [push]
# on:
# push:
# tags:
# - '*'
env:
NCNN_VERSION: 20240410
BUILD_TOOLS_VERSION: 33.0.0
jobs:
release-apk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: ncnn
run: |
wget -q https://github.com/Tencent/ncnn/releases/download/${NCNN_VERSION}/ncnn-${NCNN_VERSION}-android-vulkan.zip
unzip -q ncnn-${NCNN_VERSION}-android-vulkan.zip -d app/src/main/jni
- name: modify-jni-cmakelists
run: |
sed -i "s@ncnn-[^-]*-android-vulkan@ncnn-${NCNN_VERSION}-android-vulkan@g" app/src/main/jni/CMakeLists.txt
- name: build-apk
run: |
bash ./gradlew assembleRelease --stacktrace
- name: sign-apk
id: signapk
run: |
DATE=`date +'%Y%m%d'`
SHA_SHORT=`git rev-parse --short HEAD`
UNSIGNED_APK=`find app/build/outputs/apk/release -type f -name "*-release-unsigned.apk" | head -n 1`
ALIGNED_APK=${UNSIGNED_APK//-release-unsigned.apk/-release-unsigned-aligned.apk}
SIGNED_APK=${{ github.event.repository.name }}-${DATE}.${SHA_SHORT}.apk
keytool -genkey -noprompt -alias ncnn \
-dname "CN=mqttserver.ibm.com, OU=ID, O=IBM, L=Hursley, S=Hants, C=GB"\
-keystore ncnn.keystore -storepass 7767517 -keypass 7767517 \
-keyalg RSA -keysize 2048 -validity 10000
${ANDROID_HOME}/build-tools/${BUILD_TOOLS_VERSION}/zipalign -f -v 4 ${UNSIGNED_APK} ${SIGNED_APK}
${ANDROID_HOME}/build-tools/${BUILD_TOOLS_VERSION}/apksigner sign --ks ncnn.keystore --ks-key-alias ncnn \
--ks-pass pass:7767517 --key-pass pass:7767517 --out ${SIGNED_APK} ${SIGNED_APK}
${ANDROID_HOME}/build-tools/${BUILD_TOOLS_VERSION}/apksigner verify ${SIGNED_APK}
echo "SIGNED_APK=${SIGNED_APK}" >> $GITHUB_OUTPUT
echo "APK_VERSION=${DATE}.${SHA_SHORT}" >> $GITHUB_OUTPUT
- name: create-release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ steps.signapk.outputs.APK_VERSION }}
name: Release ${{ steps.signapk.outputs.APK_VERSION }}
files: ${{ steps.signapk.outputs.SIGNED_APK }}