add EC number search #3
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
| # Publishes a new version to PyPI whenever a `v*` tag is pushed. | |
| # | |
| # To cut a release: | |
| # 1. Bump `__version__` in pypdb/_version.py (the single source of truth). | |
| # 2. Commit, then tag and push: | |
| # git tag v2.6 && git push origin v2.6 | |
| # | |
| # Publishing uses PyPI Trusted Publishing (OIDC), so no API token is stored | |
| # here. This requires a one-time setup on PyPI: on | |
| # https://pypi.org/manage/project/pypdb/settings/publishing/ add a publisher | |
| # with owner `williamgilpin`, repository `pypdb`, workflow | |
| # `python-publish.yml`, and environment `pypi`. | |
| name: Upload Python Package | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| # Allows publishing manually from the Actions tab if a tag push is missed | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| release-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| - name: Install dependencies | |
| run: python -m pip install build pytest requests | |
| - name: Run tests | |
| run: pytest | |
| - name: Check that the tag matches the package version | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| TAG_VERSION="${GITHUB_REF_NAME#v}" | |
| PKG_VERSION="$(python -c 'import pypdb; print(pypdb.__version__)')" | |
| if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then | |
| echo "Tag $GITHUB_REF_NAME implies version $TAG_VERSION, but the" \ | |
| "package reports $PKG_VERSION." | |
| echo "Update __version__ in pypdb/_version.py to match the tag." | |
| exit 1 | |
| fi | |
| - name: Build release distributions | |
| run: python -m build | |
| - name: Upload distributions | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-dists | |
| path: dist/ | |
| pypi-publish: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - release-build | |
| permissions: | |
| # IMPORTANT: this permission is mandatory for trusted publishing | |
| id-token: write | |
| # The environment name must match the one registered with the PyPI | |
| # trusted publisher. | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/pypdb | |
| steps: | |
| - name: Retrieve release distributions | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: release-dists | |
| path: dist/ | |
| - name: Publish release distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist/ |