8000 Deploy to PyPI via Trusted Publishers (#14) · python/blurb@68193f0 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 68193f0

Browse files
authored
Deploy to PyPI via Trusted Publishers (#14)
2 parents 2b5e073 + 4bcc5b1 commit 68193f0

File tree

3 files changed

+109
-3
lines changed

3 files changed

+109
-3
lines changed

.github/workflows/release.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Build package
2+
3+
on:
4+
push:
5+
pull_request:
6+
release:
7+
types:
8+
- published
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
# Always build & lint package.
16+
build-package:
17+
name: Build & verify package
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- uses: hynek/build-and-inspect-python-package@v2
26+
27+
# Publish to Test PyPI on every commit on main.
28+
release-test-pypi:
29+
name: Publish in-dev package to test.pypi.org
30+
if: |
31+
github.repository_owner == 'python'
32+
&& github.event_name == 'push'
33+
&& github.ref == 'refs/heads/main'
34+
runs-on: ubuntu-latest
35+
needs: build-package
36+
37+
permissions:
38+
id-token: write
39+
40+
steps:
41+
- name: Download packages built by build-and-inspect-python-package
42+
uses: actions/download-artifact@v4
43+
with:
44+
name: Packages
45+
path: dist
46+
47+
- name: Publish to Test PyPI
48+
uses: pypa/gh-action-pypi-publish@release/v1
49+
with:
50+
repository-url: https://test.pypi.org/legacy/
51+
52+
# Publish to PyPI on GitHub Releases.
53+
release-pypi:
54+
name: Publish to PyPI
55+
# Only run for published releases.
56+
if: |
57+
github.repository_owner == 'python'
58+
&& github.event.action == 'published'
59+
runs-on: ubuntu-latest
60+
needs: build-package
61+
62+
environment:
63+
name: pypi
64+
url: >-
65+
https://pypi.org/project/blurb/${{
66+
github.event.release.tag_name
67+
}}
68+
69+
permissions:
70+
id-token: write
71+
72+
steps:
73+
- name: Download packages built by build-and-inspect-python-package
74+
uses: actions/download-artifact@v4
75+
with:
76+
name: Packages
77+
path: dist
78+
79+
- name: Publish to PyPI
80+
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,5 @@ ENV/
8888
# Rope project settings
8989
.ropeproject
9090

91-
# CPython checkout for cherry_picker.
92-
cherry_picker/cpython
93-
9491
# pytest
9592
.pytest_cache/

RELEASING.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Release Checklist
2+
3+
- [ ] check tests pass on [GitHub Actions](https://github.com/python/blurb/actions)
4+
[![GitHub Actions status](https://github.com/python/blurb/actions/workflows/main.yml/badge.svg)](https://github.com/python/blurb/actions/workflows/main.yml)
5+
6+
- [ ] Update [changelog](https://github.com/python/blurb/blob/main/CHANGELOG.md)
7+
8+
- [ ] Go to the [Releases page](https://github.com/python/blurb/releases) and
9+
10+
- [ ] Click "Draft a new release"
11+
12+
- [ ] Click "Choose a tag"
13+
14+
- [ ] Type the next `vX.Y.Z` version and select "**Create new tag: vX.Y.Z** on publish"
15+
16+
- [ ] Leave the "Release title" blank (it will be autofilled)
17+
18+
- [ ] Click "Generate release notes" and amend as required
19+
20+
- [ ] Click "Publish release"
21+
22+
- [ ] Check the tagged [GitHub Actions build](https://github.com/python/blurb/actions/workflows/release.yml)
23+
has deployed to [PyPI](https://pypi.org/project/blurb/#history)
24+
25+
- [ ] Check installation:
26+
27+
```bash
28+
python -m pip uninstall -y blurb && python -m pip install -U blurb && blurb help
29+
```

0 commit comments

Comments
 (0)
0