Skip to content

Autochange version on publish #3

Autochange version on publish

Autochange version on publish #3

name: Publish Python 🐍 distributions 📦
on:
tags:
- 'v*'
jobs:
build-and-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Change version
run: |
VERSION=${{ github.ref_name }}
sed -i -e "s/version='1.0.0'/version='${VERSION:1}'/g" ${{ github.workspace }}/setup.py
- name: Install dependencies
run: |
python -m ensurepip
pip install build --user
python -m build --wheel --sdist --outdir dist/
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}