Skip to content

Commit

Permalink
(github/release+publish) fix flow for publish
Browse files Browse the repository at this point in the history
  • Loading branch information
epappas committed Dec 13, 2024
1 parent 6b208f2 commit 40c276c
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish to PyPI

on:
release:
types: [released]
types: [created]

permissions:
contents: read
Expand All @@ -15,6 +15,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.release.tag_name }}

- name: Set up Python
uses: actions/setup-python@v5
Expand All @@ -24,16 +25,17 @@ jobs:
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
- name: Get release version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

- name: Update version in pyproject.toml
run: poetry version $VERSION
- name: Get version from tag
run: |
VERSION=${GITHUB_REF##*/v}
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Build and publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
poetry version $VERSION
poetry build
poetry publish
poetry publish --no-interaction

0 comments on commit 40c276c

Please sign in to comment.