Skip to content

Commit

Permalink
Add action to make a release and publish to PyPI
Browse files Browse the repository at this point in the history
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 <[email protected]>
Co-authored-by: mateuslatrova <[email protected]>
  • Loading branch information
3 people committed Dec 8, 2023
1 parent 4a88a2f commit 125ee2b
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/release_and_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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/[email protected]
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
ignore_dev_requirements: "yes"

0 comments on commit 125ee2b

Please sign in to comment.