Skip to content

🚀 Automate package distributions upload #71

🚀 Automate package distributions upload

🚀 Automate package distributions upload #71

name: Deploy to PyPI
on:
push:
branches:
- main
jobs:
release:
permissions:
id-token: write
contents: write
# Only run this job if new work is pushed to "main"
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
# Set up operating system
runs-on: ubuntu-latest
concurrency: release
# Define job steps
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Check-out repository
uses: actions/checkout@v3
with:
fetch-depth: 0
# - name: Install dependencies
# run: |
# python -m pip install poetry --upgrade pip
# poetry config virtualenvs.create false
# poetry install
# - name: Install dependencies
# run: |
# python -m pip install poetry --upgrade pip
# poetry config virtualenvs.create false
# poetry install
- name: Python Semantic Release
# Adjust tag with desired version if applicable. Version shorthand
# is NOT available, e.g. vX or vX.X will not work.
uses: python-semantic-release/python-semantic-release@v9.8.8
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force: "patch"
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: steps.release.outputs.released == 'true'
with:
password: ${{ secrets.PYPI_TOKEN }}
- name: Publish package distributions to GitHub Releases
uses: python-semantic-release/upload-to-gh-release@main
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}