Skip to content

v0.1.0a27

v0.1.0a27 #25

name: Build & Publish PyPI
# Build and publish to PyPI
# - official PyPI only on tags that start with `v`
on:
release:
types: [published]
jobs:
build_and_publish_pypi:
runs-on: ubuntu-latest
# Only run this workflow if the tag starts with "v"
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Extract Version from Tag
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Set version variable in module file
run: sed -i 's/v0.0.0/${{ github.ref_name }}/g' src/sindri/sindri.py
- name: Install poetry
run: pip install poetry
- name: Install Dependencies
run: poetry install
- name: Update project.toml Version
run: poetry version $VERSION
- name: Build and Publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build