Skip to content

Commit f4514f8

Browse files
authored
Release Build for Windows, macOS and Ubuntu Executables (#142)
1 parent f670f8b commit f4514f8

File tree

1 file changed

+94
-9
lines changed

1 file changed

+94
-9
lines changed

.github/workflows/release-build.yml

Lines changed: 94 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release Build Windows Executable 🚀
1+
name: Release Build Windows, macOS and Ubuntu Executables 🚀
22
on:
33
push:
44
tags:
@@ -37,45 +37,130 @@ jobs:
3737
name: windows-executable
3838
path: dist/*.exe
3939

40+
build-macos:
41+
name: Build macOS executable 🍎
42+
runs-on: macos-latest
43+
steps:
44+
- uses: actions/checkout@v4
45+
- name: Set up Python
46+
uses: actions/setup-python@v5
47+
with:
48+
python-version: "3.10"
49+
- name: Install dependencies
50+
run: |
51+
python -m pip install --upgrade pip
52+
pip install pyinstaller
53+
pip install paddlepaddle==3.0.0rc1 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
54+
pip install paddleocr
55+
pip install -e .
56+
57+
- name: Regenerate Resources (if using PyQt)
58+
run: |
59+
pip install pyqt5
60+
pyrcc5 -o libs/resources.py resources.qrc
61+
62+
- name: Build executable with PyInstaller
63+
run: |
64+
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
65+
66+
- name: Store the executable
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: macos-executable
70+
path: dist/PPOCRLabel
71+
72+
build-ubuntu:
73+
name: Build Ubuntu executable 🐧
74+
runs-on: ubuntu-latest
75+
steps:
76+
- uses: actions/checkout@v4
77+
- name: Set up Python
78+
uses: actions/setup-python@v5
79+
with:
80+
python-version: "3.10"
81+
- name: Install dependencies
82+
run: |
83+
python -m pip install --upgrade pip
84+
pip install pyinstaller
85+
pip install paddlepaddle==3.0.0rc1 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
86+
pip install paddleocr
87+
pip install -e .
88+
89+
- name: Install system dependencies
90+
run: |
91+
sudo apt-get update
92+
sudo apt-get install -y python3-pyqt5 pyqt5-dev-tools
93+
94+
- name: Regenerate Resources (if using PyQt)
95+
run: |
96+
pip install pyqt5
97+
pyrcc5 -o libs/resources.py resources.qrc
98+
99+
- name: Build executable with PyInstaller
100+
run: |
101+
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
102+
103+
- name: Store the executable
104+
uses: actions/upload-artifact@v4
105+
with:
106+
name: ubuntu-executable
107+
path: dist/PPOCRLabel
40108
publish-release:
41109
name: Publish Release to GitHub
42110
needs:
43111
- build-windows
112+
- build-macos
113+
- build-ubuntu
44114
runs-on: windows-latest
45115
permissions:
46116
contents: write # IMPORTANT: mandatory for making GitHub Releases
47117
steps:
48-
- name: Download the executable
118+
- name: Download the executables
49119
uses: actions/download-artifact@v4
50120
with:
51-
name: windows-executable
52121
path: dist/
53122

54123
- name: Get the version
55124
id: get_version
56125
run: echo "VERSION=${{ github.ref_name }}" >> $env:GITHUB_OUTPUT
57126

58-
- name: Rename executable file
127+
- name: Prepare release files
59128
run: |
60129
$TAG_NAME="${{ steps.get_version.outputs.VERSION }}"
61-
$FILES = Get-ChildItem -Path "dist" -Filter "*.exe" -File
62-
foreach ($FILE in $FILES) {
130+
# Rename Windows executable
131+
$WIN_FILES = Get-ChildItem -Path "dist/windows-executable" -Filter "*.exe" -File
132+
foreach ($FILE in $WIN_FILES) {
63133
$NEW_NAME = "PPOCRLabel-$TAG_NAME.exe"
64134
Copy-Item -Path $FILE.FullName -Destination "dist/$NEW_NAME"
65135
}
136+
# Rename macOS executable
137+
$MAC_FILE = "dist/macos-executable/PPOCRLabel"
138+
if (Test-Path $MAC_FILE) {
139+
Copy-Item -Path $MAC_FILE -Destination "dist/PPOCRLabel-$TAG_NAME-mac"
140+
}
141+
# Rename Ubuntu executable
142+
$UBUNTU_FILE = "dist/ubuntu-executable/PPOCRLabel"
143+
if (Test-Path $UBUNTU_FILE) {
144+
Copy-Item -Path $UBUNTU_FILE -Destination "dist/PPOCRLabel-$TAG_NAME-linux"
145+
}
66146
67-
- name: Upload executable to GitHub Release
147+
- name: Upload executables to GitHub Release
68148
env:
69149
GITHUB_TOKEN: ${{ github.token }}
70150
run: |
71151
$TAG_NAME="${{ steps.get_version.outputs.VERSION }}"
72-
# Upload the exe file directly
152+
# Upload Windows exe
73153
gh release upload $TAG_NAME "dist/PPOCRLabel-$TAG_NAME.exe" --repo ${{ github.repository }} --clobber
154+
# Upload macOS executable
155+
gh release upload $TAG_NAME "dist/PPOCRLabel-$TAG_NAME-mac" --repo ${{ github.repository }} --clobber
156+
# Upload Ubuntu executable
157+
gh release upload $TAG_NAME "dist/PPOCRLabel-$TAG_NAME-linux" --repo ${{ github.repository }} --clobber
74158
75159
- name: Generate SHA256 checksums
76160
run: |
77161
cd dist
78-
Get-FileHash -Algorithm SHA256 *.exe | Out-File -FilePath SHA256SUMS.txt
162+
# Generate checksums for both Windows and macOS executables
163+
Get-FileHash -Algorithm SHA256 PPOCRLabel-${{ steps.get_version.outputs.VERSION }}* | Out-File -FilePath SHA256SUMS.txt
79164
cd ..
80165
81166
- name: Upload checksums to GitHub Release

0 commit comments

Comments
 (0)