Publish to PyPI on new release #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/-\d+(\.\d+)+$//') # e.g. sys-lang-1.0.4 -> sys-lang | |
| 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 |