feat: add GLM-OCR as primary OCR backend, pytesseract as fallback (#260) #422
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release and PyPI Publish | |
| # Requires ADMIN_TOKEN secret (GitHub PAT with repo scope) to push release | |
| # commits to protected branches. Without it, the tag gets created but the | |
| # version bump commit is rejected by branch protection, orphaning the tag. | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| concurrency: release | |
| permissions: | |
| id-token: write | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.ADMIN_TOKEN }} | |
| - name: Check if should skip | |
| id: check_skip | |
| run: | | |
| if [ "$(git log -1 --pretty=format:'%an')" = "semantic-release" ]; then | |
| echo "skip=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Set up Python | |
| if: steps.check_skip.outputs.skip != 'true' | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install uv | |
| if: steps.check_skip.outputs.skip != 'true' | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Python Semantic Release | |
| if: steps.check_skip.outputs.skip != 'true' | |
| id: release | |
| uses: python-semantic-release/python-semantic-release@v9.15.2 | |
| with: | |
| github_token: ${{ secrets.ADMIN_TOKEN }} | |
| - name: Build package | |
| if: steps.check_skip.outputs.skip != 'true' && steps.release.outputs.released == 'true' | |
| run: uv build | |
| - name: Publish to PyPI | |
| if: steps.check_skip.outputs.skip != 'true' && steps.release.outputs.released == 'true' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| - name: Publish to GitHub Releases | |
| if: steps.check_skip.outputs.skip != 'true' && steps.release.outputs.released == 'true' | |
| uses: python-semantic-release/publish-action@v9.15.2 | |
| with: | |
| github_token: ${{ secrets.ADMIN_TOKEN }} |