0.0.49 #52
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
name: Release to PyPI | |
on: | |
release: | |
types: [published] | |
jobs: | |
quality: | |
uses: ./.github/workflows/pull-request.yaml | |
release: | |
name: Build and Publish to PyPI | |
runs-on: ubuntu-latest | |
needs: [ quality ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
- name: Auto set version from tag | |
# Ref: https://github.com/grst/python-ci-versioneer | |
run: | | |
# from refs/tags/1.2.3 get 1.2.3 | |
VERSION=$(echo $GITHUB_REF | sed 's#.*/##') | |
echo "Setting version to $VERSION" | |
PLACEHOLDER='^version\s*=.*' | |
# ensure the placeholder is there. If grep doesn't find the placeholder | |
# it exits with exit code 1 and github actions aborts the build. | |
grep -E "$PLACEHOLDER" pyproject.toml | |
sed -i -e "s/^\(version\s*=\).*/\1 \"${VERSION}\"/g" pyproject.toml | |
shell: bash | |
- name: Install wheel | |
run: python3 -m pip install --upgrade build | |
- name: Build | |
run: python3 -m build | |
- name: Publish | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |