-
Notifications
You must be signed in to change notification settings - Fork 31
88 lines (75 loc) · 3.57 KB
/
publish-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Package into exe
on:
release:
types:
- published
push:
branches:
- dev_20240303
jobs:
package_exe:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
- 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
- name: Install dependencies
run: |
pip install -r requirements.txt
- 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
- name: Remove Raw Image
run: find dist/StarRailOneDragon -type f -name "raw.png" -exec rm {} \;
- 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
- 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 }}