add CI for android (test)

This commit is contained in:
flaribbit
2021-05-28 23:33:50 +08:00
parent cf49685406
commit ae03346bb7
2 changed files with 27 additions and 24 deletions

View File

@@ -7,32 +7,23 @@ on:
branches: [ ci ]
jobs:
build-windows:
runs-on: windows-latest
build-android:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
lfs: true
- name: Download love
- name: Download Apktool
run: curl -OL https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.5.0.jar
- name: Unpack and Repack
run: |
curl -LO https://github.com/love2d/love/releases/download/11.3/love-11.3-win64.zip
7z x love-11.3-win64.zip
- name: Download ColdClear
run: |
curl -LO https://github.com/26F-Studio/Techmino/releases/download/coldclear/coldclear.zip
7z x coldclear.zip -ocoldclear
move coldclear\win64\cold_clear.dll love-11.3-win64
move coldclear\win64\CCloader.dll love-11.3-win64
- name: Pack Techmino
shell: cmd
run: |
7z a game.zip BGM document image modes parts SFX VOICE Zframework conf.lua font.ttf main.lua
move game.zip game.love
copy /b love-11.3-win64\love.exe + game.love love-11.3-win64\Techmino.exe
del love-11.3-win64\love.exe
del love-11.3-win64\lovec.exe
curl -OL https://github.com/26F-Studio/Techmino/releases/download/v0.15.1/Techmino.apk
java -jar apktool_2.5.0.jar d -s -o apk Techmino.apk
7z x -o. apk/assets/game.love libAndroid
rm apk/assets/game.love Techmino.apk
7z a -tzip apk/assets/game.love document libAndroid media parts Zframework conf.lua font.ttf main.lua
python3 .github/workflows/updateVersion.py
java -jar apktool_2.5.0.jar b -o Techmino.apk apk
- name: Artifact
uses: actions/upload-artifact@v1.0.0
uses: actions/upload-artifact@v2
with:
name: Techmino_win64
path: love-11.3-win64
name: Android
path: Techmino.apk

12
.github/workflows/updateVersion.py vendored Normal file
View File

@@ -0,0 +1,12 @@
import re
with open("conf.lua", "r") as file:
data = file.read()
versionCode = re.search("build=(\\d+)", data).group(1)
versionName = re.search('short="([^"]+)', data).group(1)
with open("apk/apktool.yml", "r+") as file:
data = file.read()
data = re.sub("versionCode:.+", f"versionCode: '{versionCode}'", data)
data = re.sub("versionName:.+", f"versionName: {versionName}", data)
file.seek(0)
file.truncate()
file.write(data)