Skip to content

Commit 86a9d30

Browse files
committed
build: trusted publishing
1 parent 9a5dfe5 commit 86a9d30

File tree

4 files changed

+71
-12
lines changed

4 files changed

+71
-12
lines changed

.github/workflows/publish.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
2+
# For details: https://github.com/coveragepy/django_coverage_plugin/blob/main/NOTICE.txt
3+
4+
name: "Publish"
5+
6+
on:
7+
push:
8+
tags:
9+
- '*'
10+
11+
permissions:
12+
contents: read
13+
14+
concurrency:
15+
group: "${{ github.workflow }}-${{ github.ref }}"
16+
cancel-in-progress: true
17+
18+
jobs:
19+
build_package:
20+
name: "Build"
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: "Check out the repo"
25+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
26+
with:
27+
persist-credentials: false
28+
29+
- name: "Set up Python"
30+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
31+
with:
32+
python-version: "3.14"
33+
34+
- name: "Install dependencies"
35+
run: |
36+
python -m pip install .[dev]
37+
38+
- name: "Build dists"
39+
run: |
40+
python -m build --sdist --wheel
41+
python -m twine check dist/*
42+
43+
- name: "Upload dists"
44+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
45+
with:
46+
name: dists
47+
path: dist/*
48+
retention-days: 7
49+
50+
publish_package:
51+
name: "Publish"
52+
needs: build_package
53+
runs-on: ubuntu-latest
54+
environment:
55+
name: pypi
56+
deployment: false
57+
permissions:
58+
id-token: write # needed for publishing to PyPI
59+
60+
steps:
61+
- name: "Download artifacts"
62+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
63+
with:
64+
name: dists
65+
path: dist/
66+
67+
- name: "Publish to PyPI"
68+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0

Makefile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ dist: ## Make the source distribution.
3030
python -m build
3131
python -m twine check dist/*
3232

33-
pypi: ## Upload the built distributions to PyPI.
34-
python -m twine upload --verbose dist/*
35-
36-
test_pypi: ## Upload the distributions to test PyPI.
37-
python -m twine upload --verbose --repository testpypi --password $$TWINE_TEST_PASSWORD dist/*
38-
3933
_install_e:
4034
python -m pip install -q -e .
4135

README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ Gibbons (`pull 108`_).
169169

170170
Dropped Django 3.x and 4.x.
171171

172+
Switched to trusted publishing.
173+
172174
.. _issue 74: https://github.com/coveragepy/django_coverage_plugin/issues/74
173175
.. _pull 108: https://github.com/coveragepy/django_coverage_plugin/pull/108
174176

howto.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,9 @@
33
- Version number in __init__.py
44
- Classifiers in pyproject.toml
55
https://pypi.python.org/pypi?%3Aaction=list_classifiers
6-
eg:
7-
Development Status :: 3 - Alpha
8-
Development Status :: 5 - Production/Stable
96
- Copyright date in NOTICE.txt
107
- Update README.rst with latest changes
118
- Kits:
12-
$ make clean dist
13-
$ make test_pypi
14-
$ make pypi
159
$ make tag
10+
# .github/workflows/publish.yml publishes with trusted publishing
1611
$ make ghrelease

0 commit comments

Comments
 (0)