move some work into independent jobs (#366)

* change build branch in build.yml

* try with get-version

* fix get-version

* fix get-version again

* try use get-version everywhere

* use apt upgrade again

* fix get-version again

* fix get-version again

* fix get-version again

* fix get-version again

* independent get-cc-url

* fix get-cc-url

* remove 2 useless commands

* try action

* try fix action

* try action

* use get-unzip

* try windows build

* fix build-windows

* fix build-love

* try build-linux

* add shell in build-linux

* put `commit id` into `get-version`

* fix `updateVersion.py -T Version`

* try build-android

* add shell into `build-android`

* move away android signing from build-android

* apply build-android on android mini

* gain snapshot action

* fixes

* fix build-love

* use build-macos

* put more into build-android

* fix build-android

* put more into build-macos

* fix

* fix

* ci: use preinstalled ndk (#367)

* fix apk location

* move `rename` into `build-android`

* fix `build-android`

* rename variable; remove a level of zips in macOS

* shallow clone

* remove tons of `./`s

* fix icon in windows and linux

* reorganize build-android

Co-authored-by: 梦飞翔 <1149761294@qq.com>
This commit is contained in:
Imple Lee
2021-10-15 01:06:17 +08:00
committed by GitHub
parent dfa356e9d9
commit 7f8efcdf41
9 changed files with 449 additions and 598 deletions

View File

@@ -0,0 +1,74 @@
name: 'build Android'
description: 'build Android package'
inputs:
type:
required: true
cc-url:
required: true
code:
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-unzip
with:
url: ${{ inputs.cc-url }}/android_aarch64.zip
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-unzip
with:
url: ${{ inputs.cc-url }}/android_armv7.zip
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: Build Techmino
shell: bash
run: |
echo "${{ inputs.SIGNING_KEY }}" | base64 -d > love-android/app/android.keystore
python3 .github/workflows/updateVersion.py -T Android${{ inputs.type }} -C ${{ inputs.code }} -N ${{ inputs.name }} -S ${{ inputs.KEY_STORE_PASSWORD }} -A ${{ inputs.ALIAS }} -K ${{ inputs.KEY_PASSWORD }}
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 }}

42
.github/actions/build-linux/action.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
name: 'build Linux'
description: 'build Linux package'
inputs:
cc-url:
required: true
file-path:
required: false
default: Techmino.AppImage
icon:
required: true
runs:
using: "composite"
steps:
- name: Download AppImageKit
shell: bash
run: |
curl -OL https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage
- name: Download love
shell: bash
run: |
curl -OL https://github.com/love2d/love/releases/download/11.3/love-11.3-x86_64.AppImage
chmod 777 love-11.3-x86_64.AppImage
./love-11.3-x86_64.AppImage --appimage-extract
- name: Download ColdClear
uses: ./.github/actions/get-unzip
with:
url: ${{ inputs.cc-url }}
- name: Pack Techmino
shell: bash
run: |
rm -rf squashfs-root/love squashfs-root/love.desktop squashfs-root/love.svg squashfs-root/.DirIcon
mv .github/build/Linux/love.template squashfs-root/love
mv .github/build/Linux/Techmino.desktop.template squashfs-root/Techmino.desktop
mv ${{ inputs.icon }} squashfs-root/icon.png
cp squashfs-root/icon.png squashfs-root/.DirIcon
chmod 777 squashfs-root/love
mkdir -p squashfs-root/usr/share/Techmino
mv document media parts Zframework conf.lua main.lua version.lua squashfs-root/usr/share/Techmino
mv CCloader.so squashfs-root/usr/share/Techmino
mv libcold_clear.so squashfs-root/usr/lib
chmod 777 appimagetool-x86_64.AppImage
./appimagetool-x86_64.AppImage squashfs-root ${{ inputs.file-path }}

11
.github/actions/build-love/action.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
name: 'build love'
description: 'build love file'
inputs:
file-path:
required: true
default: Techmino.love
runs:
using: "composite"
steps:
- run: 7z a -tzip ${{ inputs.file-path }} document media parts Zframework conf.lua main.lua version.lua
shell: bash

45
.github/actions/build-macos/action.yml vendored Normal file
View File

@@ -0,0 +1,45 @@
name: 'build Mac OS'
description: 'build Mac OS package'
inputs:
cc-url:
required: true
name:
required: true
icon:
required: true
MACOS_CERTIFICATE:
required: true
MACOS_CERTIFICATE_PWD:
required: true
runs:
using: "composite"
steps:
- uses: ./.github/actions/build-love
- name: Download template
uses: ./.github/actions/get-unzip
with:
url: https://github.com/26F-Studio/Techmino/releases/download/v0.15.1/Techmino.app.zip
- name: Download ColdClear
uses: ./.github/actions/get-unzip
with:
url: ${{ inputs.cc-url }}
- name: Modify template
shell: bash
run: |
python3 .github/workflows/updateVersion.py -T macOS -N ${{ inputs.name }}
mv Techmino.love Techmino.app/Contents/Resources
mv CCloader.dylib Techmino.app/Contents/Frameworks
mv ${{ inputs.icon }} Techmino.app/Contents/Resources/iconfile.icns
- name: Codesign executable
# In secrets:
# - MACOS_CERTIFICATE: the *.p12 Developer ID Certificate, encoded in base64
# - MACOS_CERTIFICATE_PWD: The password
shell: bash
run: |
echo ${{ inputs.MACOS_CERTIFICATE }} | base64 --decode > certificate.p12
security create-keychain -p Techminohaowan build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p Techminohaowan build.keychain
security import certificate.p12 -k build.keychain -P ${{ inputs.MACOS_CERTIFICATE_PWD }} -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k Techminohaowan build.keychain
/usr/bin/codesign --force --deep -s 79B81FC5EA155243C973B5417B0996501F00EF55 Techmino.app -v

View File

@@ -0,0 +1,49 @@
name: 'build Windows'
description: 'build Windows package'
inputs:
love-url:
required: true
love-dir:
required: true
cc-url:
required: true
version:
required: true
icon:
required: true
runs:
using: "composite"
steps:
- name: Download love
uses: ./.github/actions/get-unzip
with:
url: ${{ inputs.love-url }}
- name: move love
shell: bash
run: mv ${{ inputs.love-dir }} love
- name: Download ColdClear
uses: ./.github/actions/get-unzip
with:
url: ${{ inputs.cc-url }}
- name: Download ResourceHacker
uses: ./.github/actions/get-unzip
with:
url: http://www.angusj.com/resourcehacker/resource_hacker.zip
- uses: ./.github/actions/build-love
- name: Pack Techmino
shell: pwsh
run: |
cmd /c copy /b .\love\love.exe + .\Techmino.love .\love\Techmino.exe
del .\love\love.exe
del .\love\lovec.exe
del .\love\game.ico
del .\love\love.ico
del .\love\changes.txt
del .\love\readme.txt
move .\cold_clear.dll .\love
move .\CCloader.dll .\love
python .\.github\workflows\updateVersion.py -T Windows -N ${{ inputs.version }}
cmd /c '.\ResourceHacker.exe -open .\love\Techmino.exe -save .\love\Techmino.exe -action delete -mask ICONGROUP,,'
cmd /c '.\ResourceHacker.exe -open .\Techmino.rc -save .\Techmino.res -action compile'
cmd /c '.\ResourceHacker.exe -open .\love\Techmino.exe -save .\love\Techmino.exe -action addoverwrite -res "${{ inputs.icon }}" -mask ICONGROUP,1,'
cmd /c '.\ResourceHacker.exe -open .\love\Techmino.exe -save .\love\Techmino.exe -action addoverwrite -res ".\Techmino.res" -mask VERSIONINFO,1,'

15
.github/actions/get-unzip/action.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
name: 'get and unzip'
description: 'cURL and then 7-zip x'
inputs:
url:
required: true
dir:
required: false
default: '.'
runs:
using: "composite"
steps:
- run: curl -L ${{ inputs.url }} -o temp.zip
shell: bash
- run: 7z x temp.zip -o${{ inputs.dir }}
shell: bash

View File

@@ -0,0 +1,12 @@
name: 'update for a snapshot'
description: 'common update logic for snapshot'
inputs:
commit:
required: true
runs:
using: "composite"
steps:
- shell: bash
run: |
python3 .github/workflows/updateVersion.py -T Conf
python3 .github/workflows/updateVersion.py -T Version -H ${{ inputs.commit }}