-
Notifications
You must be signed in to change notification settings - Fork 1
172 lines (169 loc) · 5.58 KB
/
python-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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: 算法前端配置界面发布
on:
push:
tags:
- AlgorithmConfiureV*
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
jobs:
release:
name: ${{ matrix.os }} 创建Release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ] #, "macos-latest", "windows-latest"
steps:
- name: 时区设置
uses: szenius/[email protected] # 设置执行环境的时区
with:
timezoneLinux: "Asia/Shanghai"
- name: 克隆代码
uses: actions/checkout@v3
- name: 创建发行版本
continue-on-error: true
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body_path: README.md
draft: false
prerelease: false
other:
name: 打包发布-操作系统版本:(${{ matrix.os }},Python版本:${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
permissions:
contents: read
security-events: write
pull-requests: write
strategy:
fail-fast: false
matrix:
# os: ["windows-latest"] # "ubuntu-18.04", "windows-latest
os: ["windows-2019","macos-12"] # "ubuntu-18.04", "windows-latest","macos-latest"
python-version: ["3.6"]
steps:
- name: 时区设置
uses: szenius/[email protected] # 设置执行环境的时区
with:
timezoneLinux: "Asia/Shanghai"
- name: 下载代码
uses: actions/checkout@v3
with:
repository: jadehh/AlgorithmConfigUI
ref: AlgorithmConfiure
path: code
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT
- name: Windows操作系统安装Inno Setup 下载
if: runner.os == 'Windows'
uses: actions/checkout@v3
with:
repository: jadehh/InnoSetup
path: InnoSetup
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT
- name: Windows 准备Python X86 环境
if: runner.os == 'Windows'
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
architecture: x86
- name: 其他操作系统准备Python X64环境
if: runner.os != 'Windows'
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: pip升级
shell: pwsh
run: |
python -m pip install --upgrade pip
- name: Windows操作系统准备打包环境
if: runner.os == 'Windows'
shell: pwsh
run: |
pip install pywin32
pip install -r code/requirements.txt
- name: macOS操作系统准备打包环境
if: runner.os == 'macOS'
shell: pwsh
run: |
pip install -r code/requirements.txt
- name: Linux操作系统准备打包环境
if: runner.os == 'Linux'
shell: pwsh
run: |
pip install -r code/requirements.txt
wget https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage
mv appimagetool-x86_64.AppImage ~/
chmod a+x ~/appimagetool-x86_64.AppImage
sudo apt-get install libfuse2
- name: 编译打包
env:
PYTHONIOENCODING: "utf-8"
shell: pwsh
run: |
cd code
python packing.py # --specify_files samplesMain.py
- name: 测试是否打包完成
shell: pwsh
run: |
cd code/Output
ls
# 发布
- name: 发布
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files:
"./code/Output/*"
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }} # 给最高的权限
Ubuntu:
name: 打包发布-操作系统版本:(${{ matrix.os }})
runs-on: ${{ matrix.os }}
container:
image: jadehh/container_ocr:amd64-packing-1.0.2
options: --privileged
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ] # "ubuntu-18.04", "windows-latest","macos-latest"
steps:
- name: 下载代码
uses: actions/checkout@v3
with:
repository: jadehh/AlgorithmConfigUI
ref: AlgorithmConfiure
path: code
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT
- name: 准备打包环境
run: |
pip install -r code/requirements.txt
apt-get install -y wget
apt-get install -y libgl1-mesa-glx
apt-get install -y libfuse2
apt-get install -y libsm6 libxrender1 libfontconfig1
pip install opencv-python==4.2.0.34
wget https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage
mv appimagetool-x86_64.AppImage ~/
chmod a+x ~/appimagetool-x86_64.AppImage
- name: 编译打包
run: |
cd code
python packing.py # --specify_files samplesMain.py
- name: 测试是否打包完成
run: |
cd code/Output
ls
# 发布
- name: 发布
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files:
"./code/Output/*"
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }} # 给最高的权限