|
1 | | -name: Release Build Windows Executable 🚀 |
| 1 | +name: Release Build Windows, macOS and Ubuntu Executables 🚀 |
2 | 2 | on: |
3 | 3 | push: |
4 | 4 | tags: |
@@ -37,45 +37,130 @@ jobs: |
37 | 37 | name: windows-executable |
38 | 38 | path: dist/*.exe |
39 | 39 |
|
| 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 |
40 | 108 | publish-release: |
41 | 109 | name: Publish Release to GitHub |
42 | 110 | needs: |
43 | 111 | - build-windows |
| 112 | + - build-macos |
| 113 | + - build-ubuntu |
44 | 114 | runs-on: windows-latest |
45 | 115 | permissions: |
46 | 116 | contents: write # IMPORTANT: mandatory for making GitHub Releases |
47 | 117 | steps: |
48 | | - - name: Download the executable |
| 118 | + - name: Download the executables |
49 | 119 | uses: actions/download-artifact@v4 |
50 | 120 | with: |
51 | | - name: windows-executable |
52 | 121 | path: dist/ |
53 | 122 |
|
54 | 123 | - name: Get the version |
55 | 124 | id: get_version |
56 | 125 | run: echo "VERSION=${{ github.ref_name }}" >> $env:GITHUB_OUTPUT |
57 | 126 |
|
58 | | - - name: Rename executable file |
| 127 | + - name: Prepare release files |
59 | 128 | run: | |
60 | 129 | $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) { |
63 | 133 | $NEW_NAME = "PPOCRLabel-$TAG_NAME.exe" |
64 | 134 | Copy-Item -Path $FILE.FullName -Destination "dist/$NEW_NAME" |
65 | 135 | } |
| 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 | + } |
66 | 146 |
|
67 | | - - name: Upload executable to GitHub Release |
| 147 | + - name: Upload executables to GitHub Release |
68 | 148 | env: |
69 | 149 | GITHUB_TOKEN: ${{ github.token }} |
70 | 150 | run: | |
71 | 151 | $TAG_NAME="${{ steps.get_version.outputs.VERSION }}" |
72 | | - # Upload the exe file directly |
| 152 | + # Upload Windows exe |
73 | 153 | 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 |
74 | 158 |
|
75 | 159 | - name: Generate SHA256 checksums |
76 | 160 | run: | |
77 | 161 | 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 |
79 | 164 | cd .. |
80 | 165 |
|
81 | 166 | - name: Upload checksums to GitHub Release |
|
0 commit comments