Skip to content

Commit

Permalink
Configure the project for trusted publishing of tagged commits.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Feb 20, 2024
1 parent f7f423d commit 0d04831
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,11 @@ jobs:
jobs: ${{ toJSON(needs) }}

release:
environment:
release
permissions:
contents: write
id-token: write
needs:
- check
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
Expand All @@ -114,8 +117,7 @@ jobs:
python-version: 3.x
- name: Install tox
run: python -m pip install tox
- name: Run
run: tox -e release
env:
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: tox -e build
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
14 changes: 14 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,17 @@ commands =
python -m docutils docs/FAQ.rst
python -m docutils docs/INSTALLATION.rst
python -m docutils docs/TODO.rst


[testenv:build]
description = build the package and create release in GitHub
skip_install = True
deps =
build
jaraco.develop>=7.1
pass_env =
GITHUB_TOKEN
commands =
python -c "import shutil; shutil.rmtree('dist', ignore_errors=True)"
python -m build
python -m jaraco.develop.create-github-release

0 comments on commit 0d04831

Please sign in to comment.