2023-09-03 07:29:25 -07:00
|
|
|
name: Publish Python 🐍 distributions 📦 to PyPI
|
2024-12-04 14:29:38 -08:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types:
|
|
|
|
- closed
|
2023-09-03 07:29:25 -07:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-n-publish:
|
|
|
|
name: Build and publish Python 🐍 distributions 📦 to PyPI
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2024-12-04 14:29:38 -08:00
|
|
|
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
|
|
|
|
|
2023-09-03 07:29:25 -07:00
|
|
|
steps:
|
2023-09-28 16:11:28 -07:00
|
|
|
- uses: actions/checkout@v3
|
2024-12-04 14:29:38 -08:00
|
|
|
|
2023-09-28 16:11:28 -07:00
|
|
|
- name: Set up Python
|
|
|
|
uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: "3.10"
|
2023-09-03 07:29:25 -07:00
|
|
|
|
2024-12-04 14:29:38 -08:00
|
|
|
- name: Install dependencies
|
|
|
|
run: pip install toml
|
|
|
|
|
|
|
|
- name: Increment version
|
|
|
|
run: python increment_version.py
|
|
|
|
|
|
|
|
- name: Commit version increment
|
|
|
|
run: |
|
|
|
|
git config --global user.name 'github-actions'
|
|
|
|
git config --global user.email 'github-actions@github.com'
|
|
|
|
git add pyproject.toml
|
|
|
|
git commit -m 'Increment version'
|
|
|
|
|
|
|
|
- name: Push changes
|
|
|
|
run: git push
|
|
|
|
|
2023-09-28 16:11:28 -07:00
|
|
|
- name: Install poetry
|
2024-12-04 14:29:38 -08:00
|
|
|
run: pip install poetry --user
|
2023-09-03 07:29:25 -07:00
|
|
|
|
2023-09-28 16:11:28 -07:00
|
|
|
- name: Build distribution 📦
|
2024-12-04 14:29:38 -08:00
|
|
|
run: poetry build
|
2023-09-03 07:29:25 -07:00
|
|
|
|
2023-09-28 16:11:28 -07:00
|
|
|
- name: Publish distribution 📦 to PyPI
|
|
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
|
|
with:
|
2024-12-04 14:29:38 -08:00
|
|
|
password: ${{ secrets.PYPI_API_TOKEN }}
|