Fix Issue #7 #12
Workflow file for this run
This file contains 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
# Build the package and publish it to PyPI after tests pass. | |
# From https://discourse.jupyter.org/t/use-github-workflows-to-automatically-publish-to-pypi-when-new-tags-are-created/14941 | |
# fetch-depth: 0 is needed to make `git describe` work. | |
name: Publish to PyPI | |
on: | |
push: | |
tags: | |
- "*" | |
jobs: | |
publish: | |
name: publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Stamp Git tag and version | |
run: | | |
V=$(git describe --tags | tr -d 'v' | tr '-' '.' | cut -d'.' -f 1-4) | |
sed -i "s/0.0+unreleased.local/$V/" pyproject.toml | |
cat pyproject.toml | |
- name: Build package | |
run: | | |
python -m pip install -U pip build | |
python -m build | |
- name: Publish | |
uses: pypa/gh-action-pypi-publish@v1.5.0 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_KEY }} |