forked from PFCCLab/PPOCRLabel
-
Notifications
You must be signed in to change notification settings - Fork 0
168 lines (151 loc) · 6.27 KB
/
release-build.yml
File metadata and controls
168 lines (151 loc) · 6.27 KB
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
name: Release Build Windows, macOS and Ubuntu Executables 🚀
on:
push:
tags:
- 'v*' # Run only when a tag starting with 'v' is pushed
workflow_dispatch: # Allow manual trigger for testing
jobs:
build-windows:
name: Build Windows executable 🖥️
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install paddlepaddle==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
pip install -e .
- name: Regenerate Resources (if using PyQt)
run: |
pip install pyqt5
pyrcc5 -o libs/resources.py resources.qrc
- name: Build executable with PyInstaller
run: |
pyinstaller -c PPOCRLabel.py --collect-all paddleocr --collect-all pyclipper --collect-all imghdr --collect-all skimage --collect-all imgaug --collect-all scipy.io --collect-all lmdb --collect-all paddle --hidden-import=pyqt5 -p ./libs -p ./ -p ./data -p ./resources -F
- name: Store the executable
uses: actions/upload-artifact@v4
with:
name: windows-executable
path: dist/*.exe
build-macos:
name: Build macOS executable 🍎
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install paddlepaddle==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
pip install -e .
- name: Regenerate Resources (if using PyQt)
run: |
pip install pyqt5
pyrcc5 -o libs/resources.py resources.qrc
- name: Build executable with PyInstaller
run: |
pyinstaller -c PPOCRLabel.py --collect-all paddleocr --collect-all pyclipper --collect-all imghdr --collect-all skimage --collect-all imgaug --collect-all scipy.io --collect-all lmdb --collect-all paddle --hidden-import=pyqt5 -p ./libs -p ./ -p ./data -p ./resources -F
- name: Store the executable
uses: actions/upload-artifact@v4
with:
name: macos-executable
path: dist/PPOCRLabel
build-ubuntu:
name: Build Ubuntu executable 🐧
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install paddlepaddle==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
pip install -e .
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3-pyqt5 pyqt5-dev-tools
- name: Regenerate Resources (if using PyQt)
run: |
pip install pyqt5
pyrcc5 -o libs/resources.py resources.qrc
- name: Build executable with PyInstaller
run: |
pyinstaller -c PPOCRLabel.py --collect-all paddleocr --collect-all pyclipper --collect-all imghdr --collect-all skimage --collect-all imgaug --collect-all scipy.io --collect-all lmdb --collect-all paddle --hidden-import=pyqt5 -p ./libs -p ./ -p ./data -p ./resources -F
- name: Store the executable
uses: actions/upload-artifact@v4
with:
name: ubuntu-executable
path: dist/PPOCRLabel
publish-release:
name: Publish Release to GitHub
needs:
- build-windows
- build-macos
- build-ubuntu
runs-on: windows-latest
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
steps:
- name: Download the executables
uses: actions/download-artifact@v4
with:
path: dist/
- name: Get the version
id: get_version
run: echo "VERSION=${{ github.ref_name }}" >> $env:GITHUB_OUTPUT
- name: Prepare release files
run: |
$TAG_NAME="${{ steps.get_version.outputs.VERSION }}"
# Rename Windows executable
$WIN_FILES = Get-ChildItem -Path "dist/windows-executable" -Filter "*.exe" -File
foreach ($FILE in $WIN_FILES) {
$NEW_NAME = "PPOCRLabel-$TAG_NAME.exe"
Copy-Item -Path $FILE.FullName -Destination "dist/$NEW_NAME"
}
# Rename macOS executable
$MAC_FILE = "dist/macos-executable/PPOCRLabel"
if (Test-Path $MAC_FILE) {
Copy-Item -Path $MAC_FILE -Destination "dist/PPOCRLabel-$TAG_NAME-mac"
}
# Rename Ubuntu executable
$UBUNTU_FILE = "dist/ubuntu-executable/PPOCRLabel"
if (Test-Path $UBUNTU_FILE) {
Copy-Item -Path $UBUNTU_FILE -Destination "dist/PPOCRLabel-$TAG_NAME-linux"
}
- name: Upload executables to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
$TAG_NAME="${{ steps.get_version.outputs.VERSION }}"
# Upload Windows exe
gh release upload $TAG_NAME "dist/PPOCRLabel-$TAG_NAME.exe" --repo ${{ github.repository }} --clobber
# Upload macOS executable
gh release upload $TAG_NAME "dist/PPOCRLabel-$TAG_NAME-mac" --repo ${{ github.repository }} --clobber
# Upload Ubuntu executable
gh release upload $TAG_NAME "dist/PPOCRLabel-$TAG_NAME-linux" --repo ${{ github.repository }} --clobber
- name: Generate SHA256 checksums
run: |
cd dist
# Generate checksums for both Windows and macOS executables
Get-FileHash -Algorithm SHA256 PPOCRLabel-${{ steps.get_version.outputs.VERSION }}* | Out-File -FilePath SHA256SUMS.txt
cd ..
- name: Upload checksums to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
$TAG_NAME="${{ steps.get_version.outputs.VERSION }}"
gh release upload $TAG_NAME (Join-Path -Path "dist" -ChildPath "SHA256SUMS.txt") --repo ${{ github.repository }} --clobber