Skip to content

Publish to PyPI on new release #10

Publish to PyPI on new release

Publish to PyPI on new release #10

name: Publish to PyPI on new release
on:
workflow_dispatch:
release:
types: [published]
jobs:
publish:
if: ${{ startsWith(github.ref, 'refs/tags/ai-personas') == false }}
runs-on: ubuntu-24.04
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-python@v6.2.0
with:
python-version: 3.x
- id: project
run: |
git fetch --tags
TAG=$(git describe --tags --abbrev=0)
echo "The tag is: $TAG"
PROJECT=$(echo "$TAG" | sed -E 's/-[0-9]+(\.[0-9]+)+$//')
echo "PROJECT=$PROJECT" >> $GITHUB_ENV
echo "Project directory is: $PROJECT"
- run: pip install build
- run: |
echo "Current directory:"
pwd
echo "Listing contents of the directory"
ls -la
cd ${{ env.PROJECT }} && python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1.14
with:
packages-dir: ${{ env.PROJECT }}/dist