diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index df4cef6f..56fc67aa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: curl -OL https://nchc.dl.sourceforge.net/project/luabinaries/5.4.2/Tools%20Executables/lua-5.4.2_Win64_bin.zip - name: Unpack lua run: | - 7z x lua-5.4.2_Win64_bin.zip -olua + 7z x .\lua-5.4.2_Win64_bin.zip -olua rename-Item '.\lua\lua54.exe' -NewName 'lua.exe' - name: Get CommitID run: | @@ -22,28 +22,49 @@ jobs: echo "CommitID=${CommitID}" >> $env:GITHUB_ENV - name: Get Version run: | - $Version=.\lua\lua.exe .\.github\workflows\getVersion.lua -string + $Version=.\lua\lua.exe .\.github\workflows\getVersion.lua -name echo "Version=${Version}" >> $env:GITHUB_ENV - - name: Update Conf Version + - name: Update Conf run: | - python .github/workflows/updateConfVersion.py -H ${{ env.CommitID }} + python .\.github\workflows\updateVersion.py -T Conf + - name: Update Version + run: | + python .\.github\workflows\updateVersion.py -T Version -H ${{ env.CommitID }} - name: Download love run: | curl -OL https://github.com/love2d/love/releases/download/11.3/love-11.3-win64.zip - 7z x love-11.3-win64.zip + - name: Unpack love + run: | + 7z x .\love-11.3-win64.zip - name: Download ColdClear run: | - curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/20210520/win64.zip - 7z x win64.zip -ocoldclear - move coldclear\cold_clear.dll love-11.3-win64 - move coldclear\CCloader.dll love-11.3-win64 - - name: Pack Techmino - shell: cmd + curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/latest/win64.zip + - name: Unpack ColdClear run: | - 7z a -tzip game.love document media parts Zframework conf.lua font.ttf main.lua version.lua - 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 + 7z x .\win64.zip -oColdClear + - name: Download ResourceHacker + run: | + curl -OL http://www.angusj.com/resourcehacker/resource_hacker.zip + - name: Unpack ResourceHacker + run: | + 7z x .\resource_hacker.zip + - name: Pack Techmino + run: | + 7z a -tzip .\Techmino.love .\document .\media .\parts .\Zframework .\conf.lua .\font.ttf .\main.lua .\version.lua + cmd /c copy /b .\love-11.3-win64\love.exe + .\Techmino.love .\love-11.3-win64\Techmino.exe + del .\love-11.3-win64\love.exe + del .\love-11.3-win64\lovec.exe + del .\love-11.3-win64\game.ico + del .\love-11.3-win64\love.ico + del .\love-11.3-win64\changes.txt + del .\love-11.3-win64\readme.txt + move .\ColdClear\cold_clear.dll .\love-11.3-win64 + move .\ColdClear\CCloader.dll .\love-11.3-win64 + python .\.github\workflows\updateVersion.py -T Windows -N ${{ env.Version }} + cmd /c '.\ResourceHacker.exe -open .\love-11.3-win64\Techmino.exe -save .\love-11.3-win64\Techmino.exe -action delete -mask ICONGROUP,,' + cmd /c '.\ResourceHacker.exe -open .\Techmino.rc -save .\Techmino.res -action compile' + cmd /c '.\ResourceHacker.exe -open .\love-11.3-win64\Techmino.exe -save .\love-11.3-win64\Techmino.exe -action addoverwrite -res ".\build\Windows\icon.ico" -mask ICONGROUP,1,' + cmd /c '.\ResourceHacker.exe -open .\love-11.3-win64\Techmino.exe -save .\love-11.3-win64\Techmino.exe -action addoverwrite -res ".\Techmino.res" -mask VERSIONINFO,1,' - name: Upload uses: actions/upload-artifact@v2 with: @@ -65,30 +86,52 @@ jobs: echo "CommitID=${CommitID}" >> $GITHUB_ENV - name: Get Version run: | - Version=$(lua ./.github/workflows/getVersion.lua -string) + Version=$(lua ./.github/workflows/getVersion.lua -name) echo "Version=${Version}" >> $GITHUB_ENV - - name: Update Conf Version + - name: Update Conf run: | - python3 .github/workflows/updateConfVersion.py -H ${{ env.CommitID }} + python3 ./.github/workflows/updateVersion.py -T Conf + - name: Update Version + run: | + python3 ./.github/workflows/updateVersion.py -T Version -H ${{ env.CommitID }} + #我不是很懂这里为什么不能用https://github.com/AppImage/AppImageKit/releases/download/latest/appimagetool-x86_64.AppImage 但是事实就是它404了 - name: Download AppImageKit - run: curl -OL https://github.com/AppImage/AppImageKit/releases/download/12/appimagetool-x86_64.AppImage - - name: Unpack and Repack run: | - curl -OL https://github.com/26F-Studio/Techmino/releases/download/v0.15.1/Techmino.AppImage - chmod +x Techmino.AppImage appimagetool-x86_64.AppImage - ./Techmino.AppImage --appimage-extract - rm Techmino.AppImage - cd squashfs-root/usr/share/Techmino - rm -rf document media parts Zframework conf.lua font.ttf main.lua - cd ../../../.. - cp -r document media parts Zframework conf.lua font.ttf main.lua version.lua squashfs-root/usr/share/Techmino - ./appimagetool-x86_64.AppImage squashfs-root Techmino.AppImage + curl -OL https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage + - name: Download love + run: | + curl -OL https://github.com/love2d/love/releases/download/11.3/love-11.3-x86_64.AppImage + - name: Unpack love + run: | + chmod 777 ./love-11.3-x86_64.AppImage + ./love-11.3-x86_64.AppImage --appimage-extract + - name: Download ColdClear + run: | + curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/latest/linux.zip + - name: Unpack ColdClear + run: | + 7z x ./linux.zip -oColdClear + - name: Pack Techmino + run: | + rm -rf ./squashfs-root/love ./squashfs-root/love.desktop ./squashfs-root/love.svg ./squashfs-root/.DirIcon + mv ./build/Linux/love.template ./squashfs-root/love + mv ./build/Linux/Techmino.desktop.template ./squashfs-root/Techmino.desktop + mv ./build/Linux/icon_snapshot.png ./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 ./font.ttf ./main.lua ./version.lua ./squashfs-root/usr/share/Techmino + mv ./ColdClear/CCloader.so ./squashfs-root/usr/share/Techmino + mv ./ColdClear/libcold_clear.so ./squashfs-root/usr/lib + chmod 777 ./appimagetool-x86_64.AppImage + ./appimagetool-x86_64.AppImage ./squashfs-root ./Techmino.AppImage - name: Upload uses: actions/upload-artifact@v2 with: name: Techmino_${{ env.Version }}_${{ GITHUB.RUN_NUMBER }}_${{ env.CommitID }}_Linux path: Techmino.AppImage + #Android待更新 build-android: runs-on: ubuntu-20.04 steps: @@ -104,27 +147,30 @@ jobs: echo "CommitID=${CommitID}" >> $GITHUB_ENV - name: Get Version run: | - Version=$(lua ./.github/workflows/getVersion.lua -string) + Version=$(lua ./.github/workflows/getVersion.lua -name) echo "Version=${Version}" >> $GITHUB_ENV - - name: Update Conf Version + - name: Update Conf run: | - python3 .github/workflows/updateConfVersion.py -H ${{ env.CommitID }} + python3 ./.github/workflows/updateVersion.py -T Conf + - name: Update Version + run: | + python3 ./.github/workflows/updateVersion.py -T Version -H ${{ env.CommitID }} - name: Download Apktool run: curl -OL https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.5.0.jar - name: Unpack and Repack run: | 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 version.lua - python3 .github/workflows/updateAndroidVersion.py -C $(lua ./.github/workflows/getVersion.lua -code) -N $(lua ./.github/workflows/getVersion.lua -string) - java -jar apktool_2.5.0.jar b -o Techmino.apk apk + java -jar ./apktool_2.5.0.jar d -s -o apk ./Techmino.apk + 7z x ./apk/assets/game.love libAndroid -o. + rm -rf ./apk/assets/game.love ./Techmino.apk + 7z a -tzip ./apk/assets/game.love ./document ./libAndroid ./media ./parts ./Zframework ./conf.lua ./font.ttf ./main.lua ./version.lua + python3 ./.github/workflows/updateVersion.py -T Android -C $(lua ./.github/workflows/getVersion.lua -code) -N ${{ env.Version }} + java -jar ./apktool_2.5.0.jar b -o apk ./Techmino.apk - uses: 26F-Studio/sign-android-release@master name: Sign APK id: sign_app with: - releaseDirectory: . + releaseDirectory: ./Techmino.apk signingKeyBase64: ${{ secrets.SIGNING_KEY }} alias: ${{ secrets.ALIAS }} keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} @@ -154,22 +200,27 @@ jobs: echo "CommitID=${CommitID}" >> $GITHUB_ENV - name: Get Version run: | - Version=$(lua ./.github/workflows/getVersion.lua -string) + Version=$(lua ./.github/workflows/getVersion.lua -name) echo "Version=${Version}" >> $GITHUB_ENV - - name: Update Conf Version + - name: Update Conf run: | - python3 .github/workflows/updateConfVersion.py -H ${{ env.CommitID }} + python3 ./.github/workflows/updateVersion.py -T Conf + - name: Update Version + run: | + python3 ./.github/workflows/updateVersion.py -T Version -H ${{ env.CommitID }} - name: Pack love run: | - zip -r Techmino.love document media parts Zframework conf.lua font.ttf main.lua version.lua + 7z a -tzip ./Techmino.love ./document ./media ./parts ./Zframework ./conf.lua ./font.ttf ./main.lua ./version.lua - name: Download template run: | curl -OL https://github.com/26F-Studio/Techmino/releases/download/v0.15.1/Techmino.app.zip - unzip Techmino.app.zip + - name: Unpack template + run: | + 7z x ./Techmino.app.zip - name: Modify template run: | - python3 .github/workflows/updateOSXVersion.py -N $(lua ./.github/workflows/getVersion.lua -string) - mv Techmino.love Techmino.app/Contents/Resources + python3 ./.github/workflows/updateVersion.py -T macOS -N ${{ env.Version }} + mv ./Techmino.love ./Techmino.app/Contents/Resources - name: Codesign executable # In secrets: # - MACOS_CERTIFICATE: the *.p12 Developer ID Certificate, encoded in base64 @@ -187,9 +238,9 @@ jobs: /usr/bin/codesign --force --deep -s 79B81FC5EA155243C973B5417B0996501F00EF55 ./Techmino.app -v - name: Pack Techmino run: | - zip -r -y Techmino-Packed.app.zip Techmino.app + zip -r -y Techmino.zip Techmino.app - name: Upload uses: actions/upload-artifact@v2 with: name: Techmino_${{ env.Version }}_${{ GITHUB.RUN_NUMBER }}_${{ env.CommitID }}_macOS - path: Techmino-Packed.app.zip \ No newline at end of file + path: Techmino.zip \ No newline at end of file diff --git a/.github/workflows/getVersion.lua b/.github/workflows/getVersion.lua index a32b66af..98f39387 100644 --- a/.github/workflows/getVersion.lua +++ b/.github/workflows/getVersion.lua @@ -1,16 +1,25 @@ if arg[1]=="-code"then print(require"version".apkCode) -elseif arg[1]=="-string"then +elseif arg[1]=="-name"then print((require"version".string:gsub("@DEV",""))) +elseif arg[1]=="-release"then + print((require"version".string:gsub("V",""))) +elseif arg[1]=="-updateTitle"then + local note=require"parts.updateLog" + local p1=note:find("\n%d")+1 + local p2=note:find("\n",p1)-1 + note=note:sub(p1,p2) + print(note) elseif arg[1]=="-updateNote"then local note=require"parts.updateLog" - local p1=note:find("\n%d") + local p1=note:find("\n",note:find("\n%d")+1)+1 local p2=note:find("\n%d",p1+1) note=note:sub(p1,p2-2) - note=note:gsub("\t\t\t\t","_") - note=note:gsub("\t\t","") - note=note:gsub("\n([^_])","\n\n%1") - note=note:gsub("\n_","\n") - note=note:gsub("\n\n","\n",1) + note=note + :gsub("\t\t\t\t","_") + :gsub("\t\t","") + :gsub("\n([^_])","\n\n%1") + :gsub("\n_","\n") + :gsub("\n\n","\n",1) print(note) end \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..f5f50bcf --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,401 @@ +name: Techmino Release CI + +on: + push: + tags: + - '*' + +jobs: + build-windows-x64: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - name: Download lua + run: | + curl -OL https://nchc.dl.sourceforge.net/project/luabinaries/5.4.2/Tools%20Executables/lua-5.4.2_Win64_bin.zip + - name: Unpack lua + run: | + 7z x .\lua-5.4.2_Win64_bin.zip -olua + rename-Item '.\lua\lua54.exe' -NewName 'lua.exe' + - name: Update Version + run: | + python .\.github\workflows\updateVersion.py -T Version + - name: Get Version + run: | + $Version=.\lua\lua.exe .\.github\workflows\getVersion.lua -release + echo "Version=${Version}" >> $env:GITHUB_ENV + - name: Get ReleaseTitle + run: | + $Title=.\lua\lua.exe .\.github\workflows\getVersion.lua -updateTitle + echo "Title=${Title}" >> $env:GITHUB_ENV + - name: Download love + run: | + curl -OL https://github.com/love2d/love/releases/download/11.3/love-11.3-win64.zip + - name: Unpack love + run: | + 7z x .\love-11.3-win64.zip + - name: Download ColdClear + run: | + curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/latest/win64.zip + - name: Unpack ColdClear + run: | + 7z x .\win64.zip -oColdClear + - name: Download ResourceHacker + run: | + curl -OL http://www.angusj.com/resourcehacker/resource_hacker.zip + - name: Unpack ResourceHacker + run: | + 7z x .\resource_hacker.zip + - name: Pack Techmino + run: | + 7z a -tzip .\Techmino.love .\document .\media .\parts .\Zframework .\conf.lua .\font.ttf .\main.lua .\version.lua + cmd /c copy /b .\love-11.3-win64\love.exe + .\Techmino.love .\love-11.3-win64\Techmino.exe + del .\love-11.3-win64\love.exe + del .\love-11.3-win64\lovec.exe + del .\love-11.3-win64\game.ico + del .\love-11.3-win64\love.ico + del .\love-11.3-win64\changes.txt + del .\love-11.3-win64\readme.txt + move .\ColdClear\cold_clear.dll .\love-11.3-win64 + move .\ColdClear\CCloader.dll .\love-11.3-win64 + python .\.github\workflows\updateVersion.py -T Windows -N ${{ env.Version }} + cmd /c '.\ResourceHacker.exe -open .\love-11.3-win64\Techmino.exe -save .\love-11.3-win64\Techmino.exe -action delete -mask ICONGROUP,,' + cmd /c '.\ResourceHacker.exe -open .\Techmino.rc -save .\Techmino.res -action compile' + cmd /c '.\ResourceHacker.exe -open .\love-11.3-win64\Techmino.exe -save .\love-11.3-win64\Techmino.exe -action addoverwrite -res ".\build\Windows\icon.ico" -mask ICONGROUP,1,' + cmd /c '.\ResourceHacker.exe -open .\love-11.3-win64\Techmino.exe -save .\love-11.3-win64\Techmino.exe -action addoverwrite -res ".\Techmino.res" -mask VERSIONINFO,1,' + 7z a -tzip .\Techmino.a${{ env.Version }}.Win64.zip .\love-11.3-win64\ + - name: Release + uses: softprops/action-gh-release@v1 + with: + name: ${{ env.Title }} + files: Techmino.a${{ env.Version }}.Win64.zip + + build-windows-x86: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - name: Download lua + run: | + curl -OL https://nchc.dl.sourceforge.net/project/luabinaries/5.4.2/Tools%20Executables/lua-5.4.2_Win64_bin.zip + - name: Unpack lua + run: | + 7z x .\lua-5.4.2_Win64_bin.zip -olua + rename-Item '.\lua\lua54.exe' -NewName 'lua.exe' + - name: Update Version + run: | + python .\.github\workflows\updateVersion.py -T Version + - name: Get Version + run: | + $Version=.\lua\lua.exe .\.github\workflows\getVersion.lua -release + echo "Version=${Version}" >> $env:GITHUB_ENV + - name: Get ReleaseTitle + run: | + $Title=.\lua\lua.exe .\.github\workflows\getVersion.lua -updateTitle + echo "Title=${Title}" >> $env:GITHUB_ENV + - name: Download love + run: | + curl -OL https://github.com/love2d/love/releases/download/11.3/love-11.3-win32.zip + - name: Unpack love + run: | + 7z x .\love-11.3-win32.zip + - name: Download ColdClear + run: | + curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/latest/win32.zip + - name: Unpack ColdClear + run: | + 7z x .\win32.zip -oColdClear + - name: Download ResourceHacker + run: | + curl -OL http://www.angusj.com/resourcehacker/resource_hacker.zip + - name: Unpack ResourceHacker + run: | + 7z x .\resource_hacker.zip + - name: Pack Techmino + run: | + 7z a -tzip .\Techmino.love .\document .\media .\parts .\Zframework .\conf.lua .\font.ttf .\main.lua .\version.lua + cmd /c copy /b .\love-11.3-win32\love.exe + .\Techmino.love .\love-11.3-win32\Techmino.exe + del .\love-11.3-win32\love.exe + del .\love-11.3-win32\lovec.exe + del .\love-11.3-win32\game.ico + del .\love-11.3-win32\love.ico + del .\love-11.3-win32\changes.txt + del .\love-11.3-win32\readme.txt + move .\ColdClear\cold_clear.dll .\love-11.3-win32 + move .\ColdClear\CCloader.dll .\love-11.3-win32 + python .\.github\workflows\updateVersion.py -T Windows -N ${{ env.Version }} + cmd /c '.\ResourceHacker.exe -open .\love-11.3-win32\Techmino.exe -save .\love-11.3-win32\Techmino.exe -action delete -mask ICONGROUP,,' + cmd /c '.\ResourceHacker.exe -open .\Techmino.rc -save .\Techmino.res -action compile' + cmd /c '.\ResourceHacker.exe -open .\love-11.3-win32\Techmino.exe -save .\love-11.3-win32\Techmino.exe -action addoverwrite -res ".\build\Windows\icon.ico" -mask ICONGROUP,1,' + cmd /c '.\ResourceHacker.exe -open .\love-11.3-win32\Techmino.exe -save .\love-11.3-win32\Techmino.exe -action addoverwrite -res ".\Techmino.res" -mask VERSIONINFO,1,' + 7z a -tzip .\Techmino.a${{ env.Version }}.Win32.zip .\love-11.3-win32\ + - name: Release + uses: softprops/action-gh-release@v1 + with: + name: ${{ env.Title }} + files: Techmino.a${{ env.Version }}.Win32.zip + + build-linux: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Install lua + run: | + sudo apt-get update -y + sudo apt-get upgrade -y + sudo apt-get install lua5.3 -y + - name: Update Version + run: | + python3 ./.github/workflows/updateVersion.py -T Version + - name: Get Version + run: | + Version=$(lua ./.github/workflows/getVersion.lua -release) + echo "Version=${Version}" >> $GITHUB_ENV + - name: Get ReleaseTitle + run: | + Title=$(lua ./.github/workflows/getVersion.lua -updateTitle) + echo "Title=${Title}" >> $GITHUB_ENV + #我不是很懂这里为什么不能用https://github.com/AppImage/AppImageKit/releases/download/latest/appimagetool-x86_64.AppImage 但是事实就是它404了 + - name: Download AppImageKit + run: | + curl -OL https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage + - name: Download love + run: | + curl -OL https://github.com/love2d/love/releases/download/11.3/love-11.3-x86_64.AppImage + - name: Unpack love + run: | + chmod 777 ./love-11.3-x86_64.AppImage + ./love-11.3-x86_64.AppImage --appimage-extract + - name: Download ColdClear + run: | + curl -OL https://github.com/26F-Studio/cold_clear_ai_love2d_wrapper/releases/download/latest/linux.zip + - name: Unpack ColdClear + run: | + 7z x ./linux.zip -oColdClear + - name: Pack Techmino + run: | + rm -rf ./squashfs-root/love ./squashfs-root/love.desktop ./squashfs-root/love.svg ./squashfs-root/.DirIcon + mv ./build/Linux/love.template ./squashfs-root/love + mv ./build/Linux/Techmino.desktop.template ./squashfs-root/Techmino.desktop + mv ./build/Linux/icon.png ./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 ./font.ttf ./main.lua ./version.lua ./squashfs-root/usr/share/Techmino + mv ./ColdClear/CCloader.so ./squashfs-root/usr/share/Techmino + mv ./ColdClear/libcold_clear.so ./squashfs-root/usr/lib + chmod 777 ./appimagetool-x86_64.AppImage + ./appimagetool-x86_64.AppImage ./squashfs-root ./Techmino.a${{ env.Version }}.AppImage + - name: Release + uses: softprops/action-gh-release@v1 + with: + name: ${{ env.Title }} + files: Techmino.a${{ env.Version }}.AppImage + + #Android待更新 + build-android: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Install lua + run: | + sudo apt-get update -y + sudo apt-get upgrade -y + sudo apt-get install lua5.3 -y + - name: Update Version + run: | + python3 ./.github/workflows/updateVersion.py -T Version + - name: Get Version + run: | + Version=$(lua ./.github/workflows/getVersion.lua -release) + echo "Version=${Version}" >> $GITHUB_ENV + - name: Get ReleaseTitle + run: | + Title=$(lua ./.github/workflows/getVersion.lua -updateTitle) + echo "Title=${Title}" >> $GITHUB_ENV + - name: Download Apktool + run: curl -OL https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.5.0.jar + - name: Unpack and Repack + run: | + 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 ./apk/assets/game.love libAndroid -o. + rm -rf ./apk/assets/game.love ./Techmino.apk + 7z a -tzip ./apk/assets/game.love ./document ./libAndroid ./media ./parts ./Zframework ./conf.lua ./font.ttf ./main.lua ./version.lua + python3 ./.github/workflows/updateVersion.py -T Android -C $(lua ./.github/workflows/getVersion.lua -code) -N $(lua ./.github/workflows/getVersion.lua -name) + java -jar ./apktool_2.5.0.jar b -o apk ./Techmino.a${{ env.Version }}.apk + - uses: 26F-Studio/sign-android-release@master + name: Sign APK + id: sign_app + with: + releaseDirectory: ./Techmino.a${{ env.Version }}.apk + signingKeyBase64: ${{ secrets.SIGNING_KEY }} + alias: ${{ secrets.ALIAS }} + keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} + keyPassword: ${{ secrets.KEY_PASSWORD }} + env: + BUILD_TOOLS_VERSION: "30.0.2" + - name: Release + uses: softprops/action-gh-release@v1 + with: + name: ${{ env.Title }} + files: ${{steps.sign_app.outputs.signedReleaseFile}} + + #Android-mini待更新 + build-android-mini: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Install lua + run: | + sudo apt-get update -y + sudo apt-get upgrade -y + sudo apt-get install lua5.3 -y + - name: Update Version + run: | + python3 ./.github/workflows/updateVersion.py -T Version + - name: Get Version + run: | + Version=$(lua ./.github/workflows/getVersion.lua -release) + echo "Version=${Version}" >> $GITHUB_ENV + - name: Get ReleaseTitle + run: | + Title=$(lua ./.github/workflows/getVersion.lua -updateTitle) + echo "Title=${Title}" >> $GITHUB_ENV + - name: Download Apktool + run: curl -OL https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.5.0.jar + - name: Unpack and Repack + run: | + 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 ./apk/assets/game.love libAndroid -o. + rm -rf ./apk/assets/game.love ./Techmino.apk + rm -rf ./media/BGM ./media/SFX ./media/VOICE + 7z a -tzip ./apk/assets/game.love ./document ./libAndroid ./media ./parts ./Zframework ./conf.lua ./font.ttf ./main.lua ./version.lua + python3 ./.github/workflows/updateVersion.py -T Android -C $(lua ./.github/workflows/getVersion.lua -code) -N $(lua ./.github/workflows/getVersion.lua -name) + java -jar ./apktool_2.5.0.jar b -o apk ./Techmino.a${{ env.Version }}.mini.apk + - uses: 26F-Studio/sign-android-release@master + name: Sign APK + id: sign_app + with: + releaseDirectory: ./Techmino.a${{ env.Version }}.mini.apk + signingKeyBase64: ${{ secrets.SIGNING_KEY }} + alias: ${{ secrets.ALIAS }} + keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} + keyPassword: ${{ secrets.KEY_PASSWORD }} + env: + BUILD_TOOLS_VERSION: "30.0.2" + - name: Release + uses: softprops/action-gh-release@v1 + with: + name: ${{ env.Title }} + files: ${{steps.sign_app.outputs.signedReleaseFile}} + + build-macOS: + runs-on: macos-10.15 + steps: + - uses: actions/checkout@v2 + - name: Install lua + run: | + curl -OL http://www.lua.org/ftp/lua-5.4.3.tar.gz + tar zxf lua-5.4.3.tar.gz + cd lua-5.4.3 + make macosx + sudo make install + - name: Update Version + run: | + python3 ./.github/workflows/updateVersion.py -T Version + - name: Get Version + run: | + Version=$(lua ./.github/workflows/getVersion.lua -release) + echo "Version=${Version}" >> $GITHUB_ENV + - name: Get ReleaseTitle + run: | + Title=$(lua ./.github/workflows/getVersion.lua -updateTitle) + echo "Title=${Title}" >> $GITHUB_ENV + - name: Pack love + run: | + 7z a -tzip ./Techmino.love ./document ./media ./parts ./Zframework ./conf.lua ./font.ttf ./main.lua ./version.lua + - name: Download template + run: | + curl -OL https://github.com/26F-Studio/Techmino/releases/download/v0.15.1/Techmino.app.zip + - name: Unpack template + run: | + 7z x ./Techmino.app.zip + - name: Modify template + run: | + python3 ./.github/workflows/updateVersion.py -T macOS -N $(lua ./.github/workflows/getVersion.lua -name) + mv ./Techmino.love ./Techmino.app/Contents/Resources + - name: Codesign executable + # In secrets: + # - MACOS_CERTIFICATE: the *.p12 Developer ID Certificate, encoded in base64 + # - MACOS_CERTIFICATE_PWD: The password + env: + MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} + MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }} + run: | + echo $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 $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 + - name: Pack Techmino + run: | + zip -r -y Techmino.a${{ env.Version }}.macOS.zip Techmino.app + - name: Release + uses: softprops/action-gh-release@v1 + with: + name: ${{ env.Title }} + files: Techmino.a${{ env.Version }}.macOS.zip + + build-love: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Install lua + run: | + sudo apt-get update -y + sudo apt-get upgrade -y + sudo apt-get install lua5.3 -y + - name: Update Version + run: | + python3 ./.github/workflows/updateVersion.py -T Version + - name: Get Version + run: | + Version=$(lua ./.github/workflows/getVersion.lua -release) + echo "Version=${Version}" >> $GITHUB_ENV + - name: Get ReleaseTitle + run: | + Title=$(lua ./.github/workflows/getVersion.lua -updateTitle) + - name: Pack Techmino + run: | + 7z a -tzip ./Techmino.a${{ env.Version }}.love ./document ./media ./parts ./Zframework ./conf.lua ./font.ttf ./main.lua ./version.lua + - name: Release + uses: softprops/action-gh-release@v1 + with: + name: ${{ env.Title }} + files: Techmino.a${{ env.Version }}.love + + Add-Release-note: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Install lua + run: | + sudo apt-get update -y + sudo apt-get upgrade -y + sudo apt-get install lua5.3 -y + - name: Get ReleaseTitle + run: | + Title=lua ./.github/workflows/getVersion.lua -updateTitle + echo "Title=${Title}" >> $GITHUB_ENV + - name: Get ReleaseNote + run: | + Note=lua ./.github/workflows/getVersion.lua -updateNote + echo "Note=${Note}" >> $GITHUB_ENV + - name: Release + uses: softprops/action-gh-release@v1 + with: + name: ${{ env.Title }} + body: ${{ env.Note }} \ No newline at end of file diff --git a/.github/workflows/updateAndroidVersion.py b/.github/workflows/updateAndroidVersion.py deleted file mode 100644 index af6ebb8f..00000000 --- a/.github/workflows/updateAndroidVersion.py +++ /dev/null @@ -1,14 +0,0 @@ -import re, argparse - -if __name__ == '__main__': - parser = argparse.ArgumentParser(description="用于CI更新Android版本号") - parser.add_argument("-C", "--Code", type=str, help = "versionCode") - parser.add_argument("-N", "--Name", type=str, help = "versionName") - args = parser.parse_args() - with open("apk/apktool.yml", "r+") as file: - data = file.read() - data = re.sub("versionCode:.+", f"versionCode: '{args.Code}'", data) - data = re.sub("versionName:.+", f"versionName: '{args.Name}'", data) - file.seek(0) - file.truncate() - file.write(data) \ No newline at end of file diff --git a/.github/workflows/updateConfVersion.py b/.github/workflows/updateConfVersion.py deleted file mode 100644 index 25849572..00000000 --- a/.github/workflows/updateConfVersion.py +++ /dev/null @@ -1,26 +0,0 @@ -import argparse - -def updateConf(): - with open("conf.lua", "r+", encoding="utf-8") as file: - data = file.read() - data = data.replace("t.identity='Techmino'--Saving folder", "t.identity='Techmino_Snapshot'--Saving folder") - file.seek(0) - file.truncate() - file.flush() - file.write(data) - -if __name__ == "__main__": - parser = argparse.ArgumentParser(description="用于更新conf.lua") - parser.add_argument("-H", "--Hash", type=str, default = False, help = "Github提交Hash") - args = parser.parse_args() - with open("version.lua", "r+", encoding="utf-8") as file: - data = file.read() - if args.Hash != False: - data = data.replace('@DEV', f'@{args.Hash[0:4]}') - updateConf() - else: - data = data.replace('@DEV', '') - file.seek(0) - file.truncate() - file.flush() - file.write(data) \ No newline at end of file diff --git a/.github/workflows/updateVersion.py b/.github/workflows/updateVersion.py new file mode 100644 index 00000000..bc47dba1 --- /dev/null +++ b/.github/workflows/updateVersion.py @@ -0,0 +1,66 @@ +import argparse + +def updateConf(): #更新存档位置 + with open('conf.lua', 'r+', encoding='utf-8') as file: + data = file.read() + data = data.replace("t.identity='Techmino'--Saving folder", "t.identity='Techmino_Snapshot'--Saving folder") + file.seek(0) + file.truncate() + file.flush() + file.write(data) + +def updateVersion(args): #更新版本号 + with open('version.lua', 'r+', encoding='utf-8') as file: + data = file.read() + if args.Hash != False: + data = data.replace('@DEV', f'@{args.Hash[0:4]}') + updateConf() + else: + data = data.replace('@DEV', '') + file.seek(0) + file.truncate() + file.flush() + file.write(data) + +def updateMacOS(args): #更新macOS打包信息 + import datetime + with open('./build/macOS/info.plist.template', 'r', encoding='utf-8') as template: + template = ((template.read()).replace('@versionName', args.Name)).replace('@ThisYear', str(datetime.datetime.today().year)) + with open('./Techmino.app/Contents/info.plist', 'w+', encoding='utf-8') as file: + file.write(template) + +def updateWindows(args): #更新Windows打包信息 + Version = (args.Name).replace('V', '') + FileVersion = (f"{Version.replace('.', ',')},0") + with open('./build/Windows/Techmino.rc.template', 'r', encoding='utf8') as templace: + template = ((templace.read()).replace('@FileVersion', FileVersion)).replace('@Version', Version) + with open('Techmino.rc', 'w+', encoding='utf8') as file: + file.write(template) + +def updateAndroid(args): #更新Android打包信息 + import re + with open('./apk/apktool.yml', 'r+', encoding='utf-8') as file: + data = file.read() + data = re.sub("versionCode:.+", f"versionCode: '{args.Code}'", data) + data = re.sub("versionName:.+", f"versionName: '{args.Name}'", data) + file.seek(0) + file.truncate() + file.write(data) + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='用于CI更新程序各类信息') + parser.add_argument('-T', '--Type', type=str, help = '更新的种类') + parser.add_argument('-H', '--Hash', type=str, default = False, help = 'Github提交Hash') + parser.add_argument('-C', '--Code', type=str, default = False, help = 'versionCode') + parser.add_argument('-N', '--Name', type=str, default = False, help = 'versionName') + args = parser.parse_args() + if args.Type == 'Conf': + updateConf() + elif args.Type == 'Version': + updateVersion(args) + elif args.Type == 'Windows': + updateWindows(args) + elif args.Type == 'macOS': + updateMacOS(args) + elif args.Type == 'Android': + updateAndroid(args) \ No newline at end of file diff --git a/build/Linux/Techmino.desktop.template b/build/Linux/Techmino.desktop.template new file mode 100644 index 00000000..1cec86b9 --- /dev/null +++ b/build/Linux/Techmino.desktop.template @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=Techmino Alpha +Comment=Techmino is fun! +Exec=wrapper-love %f +Type=Application +Categories=Game; +Terminal=false +Icon=icon \ No newline at end of file diff --git a/build/Linux/icon.png b/build/Linux/icon.png new file mode 100644 index 00000000..4f801e67 Binary files /dev/null and b/build/Linux/icon.png differ diff --git a/build/Linux/icon_snapshot.png b/build/Linux/icon_snapshot.png new file mode 100644 index 00000000..80a9f917 Binary files /dev/null and b/build/Linux/icon_snapshot.png differ diff --git a/build/Linux/love.template b/build/Linux/love.template new file mode 100644 index 00000000..b40225c7 --- /dev/null +++ b/build/Linux/love.template @@ -0,0 +1,5 @@ +#!/bin/sh +export LOVE_LAUNCHER_LOCATION="$(dirname "$(which "$0")")" +export LD_LIBRARY_PATH="${LOVE_LAUNCHER_LOCATION}/lib/x86_64-linux-gnu:${LOVE_LAUNCHER_LOCATION}/usr/bin:${LOVE_LAUNCHER_LOCATION}/usr/lib:${LOVE_LAUNCHER_LOCATION}/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH" +/sbin/ldconfig -p | grep -q libstdc++ || export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${LOVE_LAUNCHER_LOCATION}/libstdc++/" +exec ${LOVE_BIN_WRAPPER} "${LOVE_LAUNCHER_LOCATION}/usr/bin/love" "${LOVE_LAUNCHER_LOCATION}/usr/share/Techmino" \ No newline at end of file diff --git a/build/Windows/Techmino.rc.template b/build/Windows/Techmino.rc.template new file mode 100644 index 00000000..fd415cc6 --- /dev/null +++ b/build/Windows/Techmino.rc.template @@ -0,0 +1,23 @@ +1 VERSIONINFO +FILEVERSION @FileVersion +PRODUCTVERSION @FileVersion +FILEOS 0x40004 +FILETYPE 0x1 +{ +BLOCK "StringFileInfo" +{ + BLOCK "040904B0" + { + VALUE "FileDescription", "Techmino Alpha" + VALUE "CompanyName", "26F Studio" + VALUE "LegalCopyright", "Copyright @ 26F Studio" + VALUE "ProductName", "Techmino" + VALUE "ProductVersion", "@Version" + } +} + +BLOCK "VarFileInfo" +{ + VALUE "Translation", 0x0409 0x04E4 +} +} \ No newline at end of file diff --git a/build/Windows/icon.ico b/build/Windows/icon.ico new file mode 100644 index 00000000..46184a76 Binary files /dev/null and b/build/Windows/icon.ico differ diff --git a/build/Windows/icon_snapshot.ico b/build/Windows/icon_snapshot.ico new file mode 100644 index 00000000..deabb9cc Binary files /dev/null and b/build/Windows/icon_snapshot.ico differ diff --git a/.github/workflows/updateOSXVersion.py b/build/macOS/info.plist.template similarity index 74% rename from .github/workflows/updateOSXVersion.py rename to build/macOS/info.plist.template index e4e79783..44b90389 100644 --- a/.github/workflows/updateOSXVersion.py +++ b/build/macOS/info.plist.template @@ -1,6 +1,4 @@ -import argparse, datetime - -info = r""" + @@ -21,7 +19,7 @@ info = r""" CFBundlePackageType APPL CFBundleShortVersionString - %s + @versionName CFBundleSignature LoVe CFBundleSupportedPlatforms @@ -49,18 +47,10 @@ info = r""" NSHighResolutionCapable NSHumanReadableCopyright - ©2020-%d 26F Studio, GNU LGPLv3.0 + ©2020-@ThisYear 26F Studio, GNU LGPLv3.0 NSPrincipalClass NSApplication NSSupportsAutomaticGraphicsSwitching - -""" - -if __name__ == '__main__': - parser = argparse.ArgumentParser(description="用于CI更新macOS版本号") - parser.add_argument("-N", "--Name", type=str, help = "versionName") - args = parser.parse_args() - with open("Techmino.app/Contents/info.plist", "w") as file: - file.write(info % (args.Name, datetime.datetime.today().year)) \ No newline at end of file + \ No newline at end of file