-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (128 loc) · 4.44 KB
/
main.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: build CI
on:
push:
branches: [master,main]
workflow_dispatch:
workflow_call:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [macos-latest,ubuntu-latest,windows-latest,macos-13]
runs-on: ${{matrix.os}}
if: false
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8
cache: 'pip'
cache-dependency-path: '**/requirements.txt'
- name: Cache
uses: actions/cache@v4
with:
path: build/
key: build-cache-${{ matrix.os }}
- name: Cache apt dependencies(for linux)
if: ${{runner.os == 'Linux'}}
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: python3-tk
execute_install_scripts: true
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build
run: pyinstaller -F --hidden-import=PIL._tkinter_finder --additional-hooks-dir=hooks main.py -n vcbot-bili -i .res/icon.ico
- name: Copy plugins
run: cp -r plugins ./dist
- name: pack
run: 7z a -tzip vcbots-bili-${{runner.os}}-${{runner.arch}}.zip ./dist
- name: Upload
uses: actions/upload-artifact@v4
with:
name: build-${{matrix.os}}
path: ./vcbots-bili-${{runner.os}}-${{runner.arch}}.zip
make_bundle:
name: Make bundle
strategy:
fail-fast: false
matrix:
os: [macos-latest,ubuntu-latest,macos-13]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Download Python
uses: robinraju/release-downloader@v1
with:
repository: luyanci/python-prebuilt
tag: Python-v3.8.19-2024-09-30.28
fileName: python-${{runner.os}}-${{runner.arch}}.zip
- name: Unzip
run: |
unzip python-${{runner.os}}-${{runner.arch}}.zip
mv python-build runtime
rm python-${{runner.os}}-${{runner.arch}}.zip
- name: Clean
run: rm -rf .env.example .gitignore README.md .github .git .res run.bat
- name: Install requirements
run: |
./runtime/bin/python3 -m pip install --upgrade pip
./runtime/bin/python3 -m pip install -r requirements.txt
- name: Pack
run: 7z a -tzip vcbots-bili-${{matrix.os}}-${{runner.arch}}.zip .
- name: Upload
uses: actions/upload-artifact@v4
with:
name: bundle-${{matrix.os}}
path: ./vcbots-bili-${{matrix.os}}-${{runner.arch}}.zip
make_bundle_win:
name: Make bundle(windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Download Python
run: Invoke-Webrequest https://www.python.org/ftp/python/3.8.10/python-3.8.10-embed-amd64.zip -OutFile python-3.8.10-embed-amd64.zip
- name: Unzip
run: |
Expand-Archive python-3.8.10-embed-amd64.zip -DestinationPath runtime
- name: Clean
run: |
Remove-Item -Path .github -Recurse
cmd /c "del .gitignore /s /q"
cmd /c "del README.md /s /q"
cmd /c "del .env.example /s /q"
cmd /c "del run.sh /s /q"
- name: Get pip
run: |
Invoke-Webrequest https://bootstrap.pypa.io/get-pip.py -OutFile get-pip.py
runtime/python.exe get-pip.py --no-warn-script-location --target runtime
- name: Install requirements
run: |
runtime/python.exe -m pip install --upgrade pip
runtime/python.exe -m pip install -r requirements.txt
- name: Pack
run: 7z a -tzip vcbots-bili-${{runner.os}}-${{runner.arch}}.zip .
- name: Upload
uses: actions/upload-artifact@v4
with:
name: bundle-win
path: ./vcbots-bili-${{runner.os}}-${{runner.arch}}.zip
make_bundle_no_runtime:
name: Make bundle(No Runtime)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Clean
run: |
rm -rf .env.example .gitignore README.md .github .git .res
rm -rf run.bat
rm -rf run.sh
- name: Pack
run: 7z a -tzip vcbots-bili-source.zip .
- name: Upload
uses: actions/upload-artifact@v4
with:
name: bundle-source
path: ./vcbots-bili-source.zip