* test python3 * try use `python` instead of `python3` * use `update-version` everywhere * fix variable injection * fix python2vs3 * move `updateVersion.py` into action files
103 lines
3.5 KiB
YAML
103 lines
3.5 KiB
YAML
name: 'build Android'
|
|
description: 'build Android package'
|
|
inputs:
|
|
type:
|
|
required: true
|
|
apkCode:
|
|
required: true
|
|
name:
|
|
required: true
|
|
file-path:
|
|
required: true
|
|
SIGNING_KEY:
|
|
required: true
|
|
KEY_STORE_PASSWORD:
|
|
required: true
|
|
ALIAS:
|
|
required: true
|
|
KEY_PASSWORD:
|
|
required: true
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- uses: actions/setup-java@v2
|
|
with:
|
|
distribution: 'adopt'
|
|
java-version: '8'
|
|
- name: Clone love-android
|
|
shell: bash
|
|
run: |
|
|
git clone --recurse-submodules https://github.com/26F-Studio/love-android -b CI --depth 1 --shallow-submodules
|
|
- uses: ./.github/actions/build-love
|
|
with:
|
|
file-path: love-android/app/src/main/assets/game.love
|
|
- name: Download ColdClear arm64-v8a
|
|
uses: ./.github/actions/get-cc
|
|
with:
|
|
arch: android_aarch64
|
|
dir: ColdClear/arm64-v8a
|
|
- name: Process ColdClear arm64-v8a
|
|
shell: bash
|
|
run: |
|
|
mkdir -p love-android/app/libs/arm64-v8a
|
|
mv ColdClear/arm64-v8a/love-11.3-android/lib/arm64-v8a/libcold_clear.so love-android/app/libs/arm64-v8a
|
|
mkdir -p libAndroid/arm64-v8a
|
|
mv ColdClear/arm64-v8a/libs/arm64-v8a/libCCloader.so libAndroid/arm64-v8a
|
|
- name: Download ColdClear armeabi-v7a
|
|
uses: ./.github/actions/get-cc
|
|
with:
|
|
arch: android_armv7
|
|
dir: ColdClear/armeabi-v7a
|
|
- name: Process ColdClear armeabi-v7a
|
|
shell: bash
|
|
run: |
|
|
mkdir -p love-android/app/libs/armeabi-v7a
|
|
mv ColdClear/armeabi-v7a/love-11.3-android/lib/armeabi-v7a/libcold_clear.so love-android/app/libs/armeabi-v7a
|
|
mkdir -p libAndroid/armeabi-v7a
|
|
mv ColdClear/armeabi-v7a/libs/armeabi-v7a/libCCloader.so libAndroid/armeabi-v7a
|
|
- name: Pack ColdClear
|
|
shell: bash
|
|
run: |
|
|
7z a -tzip love-android/app/src/main/assets/game.love libAndroid
|
|
- name: update Android information
|
|
shell: python
|
|
run: |
|
|
if '${{ inputs.type }}' == 'Release':
|
|
appName = 'Techmino'
|
|
packageName = 'org.love2d.MrZ.Techmino'
|
|
edition = 'release'
|
|
elif '${{ inputs.type }}' == 'Snapshot':
|
|
appName = 'Techmino_Snapshot'
|
|
packageName = 'org.love2d.MrZ.Techmino.Snapshot'
|
|
edition = 'snapshot'
|
|
with open('./love-android/app/src/main/AndroidManifest.xml', "r+", encoding='utf-8') as file:
|
|
data = file.read()
|
|
data = data\
|
|
.replace('@appName', appName)\
|
|
.replace('@edition', edition)
|
|
file.seek(0)
|
|
file.truncate()
|
|
file.write(data)
|
|
with open("./love-android/app/build.gradle", "r+", encoding='utf-8') as file:
|
|
data = file.read()
|
|
data = data\
|
|
.replace('@packageName', packageName)\
|
|
.replace('@versionCode', '${{ inputs.apkCode }}')\
|
|
.replace('@versionName', '${{ inputs.name }}')\
|
|
.replace('@storePassword', '${{ inputs.KEY_STORE_PASSWORD }}')\
|
|
.replace('@keyAlias', '${{ inputs.ALIAS }}')\
|
|
.replace('@keyPassword', '${{ inputs.KEY_PASSWORD }}')
|
|
file.seek(0)
|
|
file.truncate()
|
|
file.write(data)
|
|
- name: Build Techmino
|
|
shell: bash
|
|
run: |
|
|
echo "${{ inputs.SIGNING_KEY }}" | base64 -d > love-android/app/android.keystore
|
|
chmod 777 love-android/gradlew
|
|
cd love-android/
|
|
./gradlew assembleRelease
|
|
- name: rename apk
|
|
shell: bash
|
|
run: mv love-android/app/build/outputs/apk/release/app-release.apk ${{ inputs.file-path }}
|