PySide6 项目的构建打包
name: release
on:
push:
tags:
- '*'
jobs:
setup:
runs-on: ubuntu-latest
outputs:
PACKAGE_PREFIX: ${{ steps.get-package_prefix.outputs.PACKAGE_PREFIX }}
TAG_NAME: ${{ steps.get-package_prefix.outputs.TAG_NAME }}
HEAD_SHA_SHORT: ${{ steps.get-package_prefix.outputs.HEAD_SHA_SHORT }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: get-package_prefix
id: get-package_prefix
run: |
LIB_NAME=mycomic
TAG_NAME=$(git describe --abbrev=0 --tags)
HEAD_SHA_SHORT=$(git rev-parse --short HEAD)
echo "::set-output name=PACKAGE_PREFIX::${LIB_NAME}_${TAG_NAME}"
echo "::set-output name=TAG_NAME::${TAG_NAME}"
echo "::set-output name=HEAD_SHA_SHORT::${HEAD_SHA_SHORT}"
release:
needs: [setup]
runs-on: ubuntu-latest
outputs:
Up_Url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: create_release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.setup.outputs.TAG_NAME }}
release_name: ${{ needs.setup.outputs.TAG_NAME }}
draft: true
prerelease: true
macos:
needs: [setup, release]
runs-on: macos-latest
env:
PACKAGENAME: ${{ needs.setup.outputs.PACKAGE_PREFIX }}_macos_x64
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller==4.5.1
pip install PySide6==6.1.3
pip install websocket-client==0.59.0
pip install requests==2.26.0
pip install urllib3==1.25.11
pip install pillow==8.3.2
pip install bs4==0.0.1
pip install lxml==4.6.4
pip install pycryptodomex==3.12.0
pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.1/waifu2x_vulkan-1.1.1-cp37-cp37m-macosx_10_14_x86_64.whl
brew install create-dmg
- name: Build
run: |
cd src
cp ../res/icon/Icon.icns ./
pyinstaller --clean --onedir --name mycomic \
--hidden-import waifu2x_vulkan --hidden-import PySide6 --hidden-import requests \
--hidden-import urllib3 --hidden-import websocket-client --hidden-import pillow \
--hidden-import config \
--hidden-import component \
--hidden-import server \
--hidden-import task \
--hidden-import tools \
--hidden-import view \
--strip --windowed -i Icon.icns \
start.py
rm -rf dist/mycomic
cp Icon.icns dist/
ln -s /Applications/ dist/Applications
create-dmg --volname "mycomic" --volicon "Icon.icns" --icon "Icon.icns" 200 190 \
--hide-extension "Icon.icns" ${{ env.PACKAGENAME }}.dmg dist/
zip -9 mycomic.zip ${{ env.PACKAGENAME }}.dmg
mv ${{ env.PACKAGENAME }}.dmg ..
mv mycomic.zip ..
cd ..
- name: Upload
uses: actions/upload-artifact@v2
with:
name: ${{ env.PACKAGENAME }}
path: mycomic.zip
- name: upload-macos
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.Up_Url }}
asset_path: ${{ env.PACKAGENAME }}.dmg
asset_name: ${{ env.PACKAGENAME }}.dmg
asset_content_type: application/gzip
windows:
needs: [setup, release]
runs-on: windows-latest
env:
PACKAGENAME: ${{ needs.setup.outputs.PACKAGE_PREFIX }}_windows_x64
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller==4.8
pip install pywin32==302
pip install -r src\requirements.txt
- name: Build
run: |
cd src
cp ..\res\icon\icon.ico .\
pyinstaller -F -w -i icon.ico start.py
mv dist mycomic
cp ..\LICENSE mycomic\
cp ..\CHANGELOG mycomic\
cd ..
mkdir ${{ env.PACKAGENAME }}
mv src\mycomic ${{ env.PACKAGENAME }}
7z a -r "$($Env:PACKAGENAME + '.zip')" "mycomic"
- name: upload-macos
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.Up_Url }}
asset_path: ${{ env.PACKAGENAME }}.zip
asset_name: ${{ env.PACKAGENAME }}.zip
asset_content_type: application/zip
windows7:
needs: [setup, release]
runs-on: windows-latest
env:
PACKAGENAME: ${{ needs.setup.outputs.PACKAGE_PREFIX }}_windows7_x64
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller==4.5.1
pip install pywin32==302
pip install PySide6==6.1.3
pip install websocket-client==0.59.0
pip install requests==2.26.0
pip install urllib3==1.25.11
pip install pillow==8.3.2
pip install waifu2x-vulkan==1.1.1
pip install bs4==0.0.1
pip install lxml==4.6.4
pip install pycryptodomex==3.12.0
- name: Build
run: |
cd src
cp ..\res\icon\icon.ico .\
pyinstaller -F -w -i icon.ico start.py
mv dist mycomic
cp ..\LICENSE mycomic\
cp ..\CHANGELOG mycomic\
cd ..
mkdir ${{ env.PACKAGENAME }}
mv src\mycomic ${{ env.PACKAGENAME }}
7z a -r "$($Env:PACKAGENAME + '.zip')" "mycomic"
- name: upload-win
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.Up_Url }}
asset_path: ${{ env.PACKAGENAME }}.zip
asset_name: ${{ env.PACKAGENAME }}.zip
asset_content_type: application/zip
ubuntu:
runs-on: ubuntu-18.04
env:
PACKAGENAME: ${{ needs.setup.outputs.PACKAGE_PREFIX }}_linux
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller==4.8
pip install https://github.com/tonquer/waifu2x-vulkan/releases/download/v1.1.1/waifu2x_vulkan-1.1.1-cp37-cp37m-linux_x86_64.whl
pip install -r src/requirements.txt
- name: Build
run: |
cd src
pyinstaller -w start.py --strip
cd dist
mkdir -p mycomic.AppRun/usr/bin
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x appimagetool-x86_64.AppImage
cp -r ../../res/appimage/* mycomic.AppRun/
cp -r ../../res/icon/logo_round.png mycomic.AppRun/mycomic.png
cp -r start/* mycomic.AppRun/usr/bin/
mv mycomic.AppRun/usr/bin/start mycomic.AppRun/usr/bin/mycomic
chmod +x mycomic.AppRun/AppRun
chmod +x mycomic.AppRun/usr/bin/mycomic
./appimagetool-x86_64.AppImage mycomic.AppRun
mv mycomic-x86_64.AppImage ../../${{ env.PACKAGENAME }}-x86_64.AppImage
cd ../..
- name: upload-linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.Up_Url }}
asset_path: ${{ env.PACKAGENAME }}-x86_64.AppImage
asset_name: ${{ env.PACKAGENAME }}-x86_64.AppImage
asset_content_type: application/zip