Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
yudgugger authored Nov 26, 2024
1 parent 7358e0e commit 297bfb3
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
on:
release:
types: [published]

jobs:
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/project/pyvsnr
permissions:
contents: read
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install build and twine
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: |
python -m build
- name: Check package with Twine
run: |
twine check dist/*
- name: Determine PyPI repository
run: |
if [[ ${{ github.event.release.prerelease }} == 'true' ]]; then
echo "REPOSITORY_URL=https://test.pypi.org/legacy/" >> $GITHUB_ENV
echo "PYPI_API_TOKEN=${{ secrets.TEST_PYPI_API_TOKEN }}" >> $GITHUB_ENV
else
echo "REPOSITORY_URL=https://upload.pypi.org/legacy/" >> $GITHUB_ENV
echo "PYPI_API_TOKEN=${{ secrets.PYPI_API_TOKEN }}" >> $GITHUB_ENV
fi
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@v1.9.0
with:
repository-url: ${{ env.REPOSITORY_URL }}
user: __token__
password: ${{ env.PYPI_API_TOKEN }}

0 comments on commit 297bfb3

Please sign in to comment.