Publish to PyPI #1
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 | |
on: | |
push: | |
tags: | |
- "v*" | |
workflow_dispatch: | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
- name: Install build tools | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install build twine | |
- name: Build package | |
working-directory: packages/markitdown # Change to the correct directory | |
run: | | |
rm -rf dist | |
python -m build | |
- name: Mask API Token | |
run: echo "::add-mask::$PYPI_API_TOKEN" | |
- name: Publish to PyPI | |
working-directory: packages/markitdown # Change to the correct directory | |
env: | |
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
python -m twine upload --repository pypi dist/* \ | |
--username __token__ --password $PYPI_API_TOKEN |