Merge pull request #188 from Aiven-Open/kmichel-repair-build-system #37
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
# Based on https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ | |
name: Publish to PyPI | |
on: | |
push: | |
tags: | |
- 'releases/**' | |
jobs: | |
build-n-publish: | |
name: Build and publish | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
- name: Ensure tags are properly synced | |
run: git fetch --tags --force | |
- name: Install pypa/build | |
run: >- | |
python -m pip install build --user | |
- name: Build a binary wheel and a source tarball | |
run: >- | |
python -m | |
build | |
--sdist | |
--wheel | |
--outdir dist/ | |
. | |
- name: Verify tag is annotated | |
if: startsWith(github.ref, 'refs/tags') | |
run: >- | |
test $(git for-each-ref --format='%(objecttype)' ${GITHUB_REF}) == tag | |
- name: Publish distribution to PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |