v0.1.8 #12
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 | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/openmed | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build hatch | |
| - name: Clean package cache | |
| run: | | |
| pip uninstall openmed -y || true | |
| rm -rf ~/.cache/pip || true | |
| - name: Verify version matches tag (for releases) | |
| if: github.event_name == 'release' | |
| run: | | |
| VERSION=$(python -c "from openmed import __version__; print(__version__)") | |
| TAG=${GITHUB_REF#refs/tags/v} | |
| if [ "$VERSION" != "$TAG" ]; then | |
| echo "Version mismatch: package version $VERSION != tag version $TAG" | |
| exit 1 | |
| fi | |
| - name: Build package | |
| run: | | |
| python -m build | |
| - name: Check package | |
| run: | | |
| pip install twine | |
| twine check dist/* | |
| - name: Publish to PyPI | |
| env: | |
| HATCH_INDEX_USER: __token__ | |
| HATCH_INDEX_AUTH: ${{ secrets.PYPI_API_TOKEN }} | |
| HATCH_KEYRING: disabled | |
| run: | | |
| hatch publish |