-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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 }} |