Skip to content
name: Publish Python 🐍 distributions 📦 to PyPI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/[email protected]
with:
python-version: 3.11
- name: Set up Git user
run: |
git config --global user.email "hminaee-tc"
git config --global user.name "[email protected]"
# - name: Set up Git user
# run: |
# git config --global user.email "${{ secrets.GIT_USER_EMAIL }}"
# git config --global user.name "${{ secrets.GIT_USER_NAME }}"
- name: Install bump2version
run: pip install bump2version
- name: Bump version
run: bump2version minor --verbose # or minor or major, depending on your needs
- name: Commit files
run: |
git commit -m "Bump version" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- name: Install twine
run: pip install twine
- name: install setuptools
run: pip install setuptools
- name: Build the package
run: python setup.py sdist
# - name: Publish the package
# run: twine upload --skip-existing --repository-url https://upload.pypi.org/legacy/ -u __token__ -p ${{ secrets.PYPI_TOKEN }} ${{ github.workspace }}/dist/*
# - name: Retrieve release distributions
# uses: actions/download-artifact@v4
# with:
# name: release-dists
# path: dist/
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1