Skip to content

Merge pull request #187 from Aiven-Open/kmichel-close #36

Merge pull request #187 from Aiven-Open/kmichel-close

Merge pull request #187 from Aiven-Open/kmichel-close #36

Workflow file for this run

# 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 }}