diff --git a/.github/workflows/packaging.yml b/.github/workflows/build.yml similarity index 77% rename from .github/workflows/packaging.yml rename to .github/workflows/build.yml index c4545b53..053581c3 100644 --- a/.github/workflows/packaging.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Packaging +name: Build on: [push, pull_request] @@ -19,4 +19,9 @@ jobs: python -m pip install tox - name: Build package run: | - tox -e packaging + tox -e build + - name: Test upload dist + uses: actions/upload-artifact@v4 + with: + name: test-dists + path: dist/ diff --git a/.github/workflows/release.yml b/.github/workflows/publish.yml similarity index 60% rename from .github/workflows/release.yml rename to .github/workflows/publish.yml index b4ff6d8c..b84249a6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -name: Release +name: Publish on: push: @@ -8,6 +8,11 @@ on: jobs: release: runs-on: ubuntu-22.04 + environment: + name: pypi + url: https://pypi.org/project/loguru/ + permissions: + id-token: write steps: - name: Checkout repository uses: actions/checkout@v4 @@ -19,9 +24,8 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install tox - - name: Publish release - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + - name: Build package run: | - tox -e release + tox -e build + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/tox.ini b/tox.ini index bc3ad216..7b76f478 100644 --- a/tox.ini +++ b/tox.ini @@ -24,17 +24,8 @@ description = Build the HTML documentation. commands = sphinx-build -a -b html -W --keep-going docs/ docs/build -[testenv:packaging] +[testenv:build] description = Build the Python package. commands = pyproject-build . twine check --strict dist/* - -[testenv:release] -description = Publish a new release on PyPI. -passenv = - TWINE_USERNAME - TWINE_PASSWORD -commands = - {[testenv:packaging]commands} - twine upload dist/* --disable-progress-bar --verbose