Skip to content

Commit

Permalink
ci: Use PyPI trusted publishing (#1077)
Browse files Browse the repository at this point in the history
  • Loading branch information
kesara authored Jan 15, 2024
1 parent cd66aec commit 3c26a7d
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ on:

jobs:
publish:
environment: release
runs-on: ubuntu-latest
permissions:
id-token: write
outputs:
pkg_version: ${{ steps.semver.outputs.next }}

Expand Down Expand Up @@ -99,18 +102,7 @@ jobs:
echo "Using version $PKG_VERSION_STRICT"
sed -i -r -e "s/^__version__ += '.*'$/__version__ = '$PKG_VERSION_STRICT'/" xml2rfc/__init__.py
python -m build --sdist
- name: Publish to Test PyPI
if: env.SHOULD_DEPLOY != 'true'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
run: |
echo "Using repository $TWINE_REPOSITORY_URL"
twine check dist/*
twine upload --verbose dist/*
- name: Update CHANGELOG
id: changelog
uses: Requarks/changelog-action@v1
Expand Down Expand Up @@ -150,6 +142,15 @@ jobs:
setup.cfg
xml2rfc/__init__.py
- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

- name: Publish to PyPI
if: env.SHOULD_DEPLOY == 'true'
uses: pypa/gh-action-pypi-publish@release/v1

build-base:
runs-on: ubuntu-latest
if: github.event.inputs.publish
Expand Down

0 comments on commit 3c26a7d

Please sign in to comment.