Skip to content

Commit

Permalink
Set up trusted publishing (#359)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonchang authored Dec 16, 2024
1 parent 61adbc6 commit 6688b5b
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
run: |
# double echo to strip whitespace
gitd=$(echo $(git describe --tags))
echo "::set-output name=tag::$gitd"
echo "tag=$gitd"' >> $GITHUB_OUTPUT
poetryv=$(echo v$(poetry version | cut -d ' ' -f2))
echo $gitd
echo $poetryv
Expand All @@ -64,16 +64,28 @@ jobs:
# Torture git-describe into an acceptable Python version format
new_tag=$(git describe --tags | cut -c2- | sed 's/-/+/' | sed 's/-/./g')
echo $new_tag
echo "::set-output name=version::$new_tag"
echo "version=$new_tag" >> $GITHUB_OUTPUT
poetry version $new_tag
poetry build
- uses: actions/upload-artifact@v4
if: matrix.python-version == '3.13'
with:
name: ${{ steps.build.outputs.version }}
path: dist
- if: startsWith(github.event.ref, 'refs/tags') && matrix.python-version == '3.13'
uses: pypa/[email protected]
publish-to-pypi:
name: Publish distribution to PyPI
if: startsWith(github.event.ref, 'refs/tags')
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/tact
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
user: __token__
password: ${{ secrets.pypi_key }}
name: ${{ steps.build.outputs.version }}
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit 6688b5b

Please sign in to comment.