Package MarkAI for uvx markai, vendor pdf.js, add CI and PyPI release
#1
Workflow file for this run
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: Publish to PyPI | |
| # Tag a release and it ships: | |
| # git tag v0.1.0 && git push --tags | |
| # | |
| # Authentication is PyPI Trusted Publishing (OIDC) — there is no API token to | |
| # store or rotate. One-time setup on PyPI: project "markai" → Publishing → add a | |
| # GitHub publisher with owner "follen99", repository "MarkAI", workflow | |
| # "publish.yml", environment "pypi". | |
| on: | |
| push: | |
| tags: ["v*"] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build distributions | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - name: Build sdist and wheel | |
| run: | | |
| python -m pip install --upgrade pip build | |
| python -m build | |
| - name: Verify the tag matches the package version | |
| # A tag that disagrees with markai/__init__.py would publish a surprise | |
| # version number that can never be corrected — PyPI releases are final. | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install . | |
| VERSION=$(python -c "import markai; print(markai.__version__)") | |
| TAG="${GITHUB_REF_NAME#v}" | |
| if [ "$GITHUB_REF_TYPE" = "tag" ] && [ "$VERSION" != "$TAG" ]; then | |
| echo "Tag $GITHUB_REF_NAME does not match markai.__version__ ($VERSION)" >&2 | |
| exit 1 | |
| fi | |
| - name: Check the built metadata | |
| run: | | |
| python -m pip install twine | |
| python -m twine check dist/* | |
| - name: Smoke-test the built wheel | |
| run: python tests/smoke_test.py | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| publish: | |
| name: Publish | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/markai | |
| permissions: | |
| id-token: write # required for trusted publishing | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - uses: pypa/gh-action-pypi-publish@release/v1 |