pipreqs/.github/workflows/release_and_publish.yml
Lucas de Sousa Rosa 125ee2bcfd Add action to make a release and publish to PyPI
This GitHub Actions workflow automates two tasks:

1. **Create Release:**
   - Triggered when a new version tag (formatted as `vX.X.X`) is pushed.
   - Creates a release with the tag name, marking it as the latest version.

2. **Publish to PyPI:**
   - Runs after the release is created successfully.
   - Builds and publishes the Python package to PyPI using Poetry.
   - Ignores development requirements during the publishing process.

This ensures that each new version gets a release on GitHub and the corresponding Python package is published on PyPI.

Co-authored-by: Darwish Ahmad Herati <13837531+daherati@users.noreply.github.com>
Co-authored-by: mateuslatrova <57113699+mateuslatrova@users.noreply.github.com>
2023-12-08 18:27:27 -03:00

32 lines
703 B
YAML

name: Create and publish a release
on:
push:
tags:
- 'v*.*.*'
jobs:
create_release:
name: Create Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: ncipollo/release-action@v1
with:
name: Release ${{ github.ref_name }}
makeLatest: true
publish_to_pypi:
name: Publish to PyPI
needs: create_release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and publish to PyPI
uses: JRubics/poetry-publish@v1.17
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
ignore_dev_requirements: "yes"