Package into exe #104
Workflow file for this run
This file contains 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
name: Package into exe | |
on: | |
release: | |
types: | |
- published | |
jobs: | |
package_exe: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get latest update time | |
run: | | |
$config_time = git log -1 --format="%ad" --date=format:'%Y-%m-%d %H:%M:%S' -- config | |
$data_time = git log -1 --format="%ad" --date=format:'%Y-%m-%d %H:%M:%S' -- data | |
$images_time = git log -1 --format="%ad" --date=format:'%Y-%m-%d %H:%M:%S' -- images | |
$model_time = git log -1 --format="%ad" --date=format:'%Y-%m-%d %H:%M:%S' -- model | |
$requirements_time = git log -1 --format="%ad" --date=format:'%Y-%m-%d %H:%M:%S' -- requirements.txt | |
$src_time = git log -1 --format="%ad" --date=format:'%Y-%m-%d %H:%M:%S' -- src | |
$version = "${{ github.event.release.tag_name }}" | |
$yaml = @" | |
version: "$version" | |
config: "$config_time" | |
data: "$data_time" | |
images: "$images_time" | |
model: "$model_time" | |
requirements: "$requirements_time" | |
src: "$src_time" | |
"@ | |
$yaml | Out-File -FilePath version.yml | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11.3 | |
- name: Install dependencies | |
run: | | |
pip install -r requirements-prod.txt | |
pip install -r requirements-dev-ext.txt | |
pip freeze | |
- name: Package Exe by PyInstaller | |
run: pyinstaller src/gui/app.py --name StarRailOneDragon --clean --noconfirm --noconsole --icon "images/ui/icon.ico" --add-data "images:images" --add-data "data:data" --add-data "config:config" --add-data "model:model" --add-data "version.yml:." --add-data "update_by_temp.bat:." --collect-all paddle --collect-all paddleocr --collect-all shapely --collect-all pyclipper --collect-all skimage --collect-all imghdr --collect-all imgaug --collect-all lmdb --collect-all scipy | |
- name: Remove Raw Image | |
run: Get-ChildItem -Path ./dist/StarRailOneDragon/ -Filter "raw.png" -Recurse | Remove-Item | |
- name: Checkout wiki | |
uses: actions/checkout@v4 | |
with: | |
repository: DoctorReid/StarRailOneDragon.wiki | |
ref: master | |
fetch-depth: 1 | |
path: wiki | |
- name: Zip All | |
run: | | |
cp ./wiki/output/README.pdf ./dist/StarRailOneDragon/ | |
cd dist | |
7z a StarRailOneDragon-${{ github.event.release.tag_name }}.zip StarRailOneDragon | |
7z a -r config.zip StarRailOneDragon/_internal/config/** | |
7z a -r data.zip StarRailOneDragon/_internal/data/** | |
7z a -r images.zip StarRailOneDragon/_internal/images/** | |
7z a -r model.zip StarRailOneDragon/_internal/model/** | |
7z a -r src.zip StarRailOneDragon/StarRailOneDragon.exe StarRailOneDragon/README.pdf | |
- name: Upload All | |
run: | | |
cd dist | |
gh release upload ${{ github.event.release.tag_name }} StarRailOneDragon-${{ github.event.release.tag_name }}.zip --clobber | |
gh release upload ${{ github.event.release.tag_name }} config.zip --clobber | |
gh release upload ${{ github.event.release.tag_name }} data.zip --clobber | |
gh release upload ${{ github.event.release.tag_name }} images.zip --clobber | |
gh release upload ${{ github.event.release.tag_name }} model.zip --clobber | |
gh release upload ${{ github.event.release.tag_name }} src.zip --clobber | |
gh release upload ${{ github.event.release.tag_name }} StarRailOneDragon/_internal/version.yml --clobber | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |