Skip to content

Commit 007b4e7

Browse files
committed
Update release.py and release docs for GHA PyPI publishing.
1 parent be62a60 commit 007b4e7

File tree

2 files changed

+25
-29
lines changed

2 files changed

+25
-29
lines changed

docs/dev.rst

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,25 +226,31 @@ Making a release
226226

227227
.. note::
228228

229-
:gh:`scripts/release.py <scripts/release.py>` already does most of these.
229+
The :gh:`release.py <scripts/release.py>` script together with
230+
the :gh:`publish <.github/workflows/publish.yaml>` GitHub Actions workflow
231+
already do most of these.
230232

231233
Making a release (from ``x`` to ``y`` == ``x + 1``):
232234

233235
* (release.py) bump version in ``src/reader/__init__.py`` to ``y``
234236
* (release.py) update changelog with release version and date
235237
* (release.py) make sure tests pass / docs build
236-
* (release.py) clean up dist/: ``rm -rf dist/``
237-
* (release.py) build tarball and wheel: ``python -m build``
238238
* (release.py) push to GitHub
239-
* (release.py prompts) wait for GitHub Actions / Codecov / Read the Docs builds to pass
240-
* upload to test PyPI and check: ``twine upload --repository-url https://test.pypi.org/legacy/ dist/*``
241-
* (release.py) upload to PyPI: ``twine upload dist/*``
239+
* (release.py prompts) wait for GitHub Actions / Read the Docs builds to pass
242240
* (release.py) tag current commit with `<major>.<minor>` and `<major>.x`
243-
(e.g. when releasing `1.20`: `1.20` and `1.x`)
244-
* (release.py prompts) create release in GitHub
245-
* build docs from latest and enable ``y`` docs version (should happen automatically after the first time)
241+
(e.g. when releasing `1.20`: `1.20` and `1.x`) and push tags to GitHub
242+
* (release.py prompts) approve publish workflow
243+
* (publish workflow) build and upload to PyPI
244+
* alternatively, to make a manual release (should not be needed)
245+
246+
* clean up dist/: ``rm -rf dist/``
247+
* build tarball and wheel: ``python -m build``
248+
* upload to test PyPI and check: ``twine upload --repository-url https://test.pypi.org/legacy/ dist/*``
249+
* upload to PyPI: ``twine upload dist/*``
250+
251+
* (publish workflow) create draft release in GitHub
252+
* (release.py prompts) publish release in GitHub
246253
* (release.py) bump versions from ``y`` to ``(y + 1).dev0``, add ``(y + 1)`` changelog section
247-
* (release.py prompts) trigger Read the Docs build for `<major>.x` (doesn't happen automatically)
248254

249255

250256

scripts/release.py

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ def run_tox():
3434
run_no_venv('tox -p all', shell=True)
3535

3636

37-
def build():
38-
run('rm -rf dist/', shell=True)
39-
run('python -m build', shell=True)
40-
41-
4237
def path_sub(pattern, repl, path):
4338
with open(path) as f:
4439
text = f.read()
@@ -112,10 +107,6 @@ def check_unpushed():
112107
abort("unpushed changes\n\n{}\n", p.stdout.strip('\n'))
113108

114109

115-
def upload_to_pypi():
116-
run('twine upload dist/*', shell=True)
117-
118-
119110
def add_and_push_tags(tags):
120111
for tag in tags:
121112
run(['git', 'tag', '--force', tag])
@@ -150,10 +141,6 @@ def main(version, new_version, date, tox, changelog):
150141

151142
confirm("Wait for GitHub Actions / Read the Docs builds to pass.")
152143

153-
confirm("Upload to PyPI?")
154-
build()
155-
upload_to_pypi()
156-
157144
tags = [version]
158145
version_x = version.partition('.')[0] + '.x'
159146
if new_version_is_final:
@@ -162,7 +149,15 @@ def main(version, new_version, date, tox, changelog):
162149
confirm(f"Add and push tags ({', '.join(tags)})?")
163150
add_and_push_tags(tags)
164151

165-
confirm("Create release {} in GitHub (doesn't happen automatically).", version)
152+
confirm(
153+
"Approve publish workflow to upload to PyPI.\n {}\nDone?",
154+
"https://github.com/lemon24/reader/actions/workflows/publish.yaml",
155+
)
156+
confirm(
157+
"Publish draft release {} in GitHub.\n {}\nDone?",
158+
version,
159+
"https://github.com/lemon24/reader/releases",
160+
)
166161

167162
new_version_full = f"{new_version}.dev0"
168163
update_init_version(new_version_full)
@@ -173,11 +168,6 @@ def main(version, new_version, date, tox, changelog):
173168
confirm("Push version {}?", new_version_full)
174169
push()
175170

176-
# TODO: I just enabled branch or tag creation/deletion for the RtD webhook in GitHub, this might not be needed next time.
177-
confirm(
178-
f"Trigger Read the Docs build for {version_x} (doesn't happen automatically)."
179-
)
180-
181171

182172
if __name__ == '__main__':
183173
main()

0 commit comments

Comments
 (0)