Build and Release #237
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright 2024, MCSL Team, mailto:services@mcsl.com.cn | |
| # | |
| # Part of "MCSL2", a simple and multifunctional Minecraft server launcher. | |
| # | |
| # Licensed under the GNU General Public License, Version 3.0, with our | |
| # additional agreements. (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # https://github.com/MCSLTeam/MCSL2/raw/master/LICENSE | |
| # | |
| ################################################################################ | |
| name: Build and Release | |
| on: workflow_dispatch | |
| permissions: write-all | |
| jobs: | |
| Windows: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: | | |
| pyproject.toml | |
| - name: Install Python 3.8 | |
| run: uv python install 3.8 | |
| - name: Sync Dependencies | |
| shell: pwsh | |
| run: | | |
| rm uv.lock | |
| uv sync --no-dev | |
| - name: Build | |
| run: | | |
| uv run lndl_nuitka . -y -- --disable-console | |
| - name: Optimize | |
| shell: pwsh | |
| run: | | |
| Remove-Item -Force -Recurse .\build\MCSL2.dist\zstandard | |
| Remove-Item -Force -Recurse .\build\MCSL2.dist\_asyncio.pyd | |
| Remove-Item -Force -Recurse .\build\MCSL2.dist\pyexpat.pyd | |
| Remove-Item -Force -Recurse .\build\MCSL2.dist\qt5qml.dll | |
| Remove-Item -Force -Recurse .\build\MCSL2.dist\qt5qmlmodels.dll | |
| Remove-Item -Force -Recurse .\build\MCSL2.dist\qt5quick.dll | |
| .\upx.exe -9 build/MCSL2.dist/_ctypes.pyd build/MCSL2.dist/_decimal.pyd build/MCSL2.dist/_elementtree.pyd build/MCSL2.dist/_lzma.pyd build/MCSL2.dist/_overlapped.pyd build/MCSL2.dist/_socket.pyd build/MCSL2.dist/_ssl.pyd build/MCSL2.dist/_win32sysloader.pyd build/MCSL2.dist/libffi-7.dll build/MCSL2.dist/libcrypto-1_1.dll build/MCSL2.dist/libssl-1_1.dll build/MCSL2.dist/MCSL2.exe build/MCSL2.dist/python38.dll build/MCSL2.dist/pythoncom38.dll build/MCSL2.dist/pywintypes38.dll build/MCSL2.dist/qt5core.dll build/MCSL2.dist/qt5dbus.dll build/MCSL2.dist/qt5gui.dll build/MCSL2.dist/qt5multimedia.dll build/MCSL2.dist/qt5network.dll build/MCSL2.dist/qt5printsupport.dll build/MCSL2.dist/qt5svg.dll build/MCSL2.dist/qt5websockets.dll build/MCSL2.dist/qt5widgets.dll build/MCSL2.dist/qt5xml.dll build/MCSL2.dist/select.pyd build/MCSL2.dist/unicodedata.pyd build/MCSL2.dist/win32api.pyd build/MCSL2.dist/win32gui.pyd build/MCSL2.dist/win32print.pyd | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: MCSL2-Windows-x64 | |
| path: | | |
| build/MCSL2.dist/**/* | |
| Linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install Tools | |
| run: | | |
| sudo apt-get install libfuse2 | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: | | |
| pyproject.toml | |
| - name: Install Python 3.8 | |
| run: uv python install 3.8 | |
| - name: Sync Dependencies | |
| shell: pwsh | |
| run: | | |
| rm uv.lock | |
| uv sync --no-dev | |
| - name: Build | |
| run: | | |
| uv run lndl_nuitka . -y -- --disable-console | |
| - name: Optimize | |
| run: | | |
| cd build | |
| cd MCSL2.dist | |
| rm -r zstandard | |
| sudo rm libQt5Quick.so.5 | |
| sudo rm libQt5Qml.so.5 | |
| sudo rm libQt5QmlModels.so.5 | |
| sudo rm _asyncio.so | |
| sudo rm _queue.so | |
| upx -9 MCSL2.bin | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: MCSL2-Linux-x64 | |
| path: | | |
| build/MCSL2.dist/**/* | |
| Release: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - Windows | |
| - Linux | |
| steps: | |
| - uses: szenius/set-timezone@v2.0 | |
| with: | |
| timezoneLinux: 'Asia/Shanghai' | |
| - name: Install tools | |
| run: sudo apt install p7zip-full | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v3 | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| path: repo | |
| - name: Set Environment Variable | |
| run: | | |
| cd repo | |
| mcsl2_version=$(python -c "from MCSL2Lib import MCSL2VERSION; print(MCSL2VERSION)") | |
| echo "MCSL2_VERSION=$mcsl2_version" >> $GITHUB_ENV | |
| cd .. | |
| - name: Compress | |
| run: | | |
| 7z a -tzip "MCSL2-${{ env.MCSL2_VERSION }}-Windows-x64.zip" "./MCSL2-Windows-x64/*" | |
| 7z a -tzip "MCSL2-${{ env.MCSL2_VERSION }}-Linux-x64.zip" "./MCSL2-Linux-x64/*" | |
| mkdir Update | |
| cd Update | |
| mkdir Linux-x64 Windows-x64 | |
| cd Linux-x64 | |
| mkdir MCSL2Lib | |
| cd .. | |
| cd Windows-x64 | |
| mkdir MCSL2Lib | |
| cd .. | |
| cp -r ../MCSL2-Linux-x64/MCSL2.bin Linux-x64/ | |
| cp -r ../MCSL2-Windows-x64/MCSL2.exe Windows-x64/ | |
| cp -r ../MCSL2-Linux-x64/MCSL2Lib/verification.so Linux-x64/MCSL2Lib/ | |
| cp -r ../MCSL2-Windows-x64/MCSL2Lib/verification.pyd Windows-x64/MCSL2Lib/ | |
| cd .. | |
| 7z a -tzip "Update-${{ env.MCSL2_VERSION }}.zip" "./Update/*" | |
| - name: Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| body_path: ./repo/ChangeLog.md | |
| prerelease: true | |
| draft: false | |
| tag_name: v${{ env.MCSL2_VERSION }} | |
| files: | | |
| *.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |