Skip to content

Commit 1fb9ba1

Browse files
chore: simplify the release process
1 parent edacafa commit 1fb9ba1

File tree

4 files changed

+120
-38
lines changed

4 files changed

+120
-38
lines changed

.github/maintainers_guide.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,22 @@ If you want to test the package locally you can.
113113

114114
[TestPyPI](https://test.pypi.org/) is a separate instance of the Python Package
115115
Index that allows you to try distribution tools and processes without affecting
116-
the real index. This is useful with changes that relate to the package itself,
117-
example the contents of the `pyproject.toml`
116+
the real index. This is particularly useful when making changes related to the
117+
package configuration itself, for example, modifications to the `pyproject.toml` file.
118118

119-
The following can be used to deploy this project on <https://test.pypi.org/>.
119+
You can deploy this project to TestPyPI using GitHub Actions.
120120

121-
```zsh
121+
To deploy using GitHub Actions:
122+
123+
1. Push your changes to a branch or tag
124+
2. Navigate to <https://github.com/slackapi/python-slack-hooks/actions/workflows/pypi-release.yml>
125+
3. Click on "Run workflow"
126+
4. Select your branch or tag from the dropdown
127+
5. Click "Run workflow" to build and deploy your branch to TestPyPI
128+
129+
Alternatively, you can deploy from your local machine with:
122130

131+
```sh
123132
./scripts/deploy_to_test_pypi.sh
124133
```
125134

.github/release.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuring-automatically-generated-release-notes
2+
changelog:
3+
categories:
4+
- title: 🚀 Enhancements
5+
labels:
6+
- enhancement
7+
- title: 🐛 Bug Fixes
8+
labels:
9+
- bug
10+
- title: 📚 Documentation
11+
labels:
12+
- docs
13+
- title: 🤖 Build
14+
labels:
15+
- build
16+
- title: 🧪 Testing/Code Health
17+
labels:
18+
- code health
19+
- title: 🔒 Security
20+
labels:
21+
- security
22+
- title: 📦 Other changes
23+
labels:
24+
- "*"

.github/workflows/pypi-release.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Upload A Release to pypi.org or test.pypi.org
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
workflow_dispatch:
8+
inputs:
9+
dry_run:
10+
description: "Dry run (build only, do not publish)"
11+
required: false
12+
type: boolean
13+
default: false
14+
15+
jobs:
16+
release-build:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
21+
with:
22+
persist-credentials: false
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
26+
with:
27+
python-version: "3.x"
28+
29+
- name: Build release distributions
30+
run: |
31+
scripts/build_pypi_package.sh
32+
33+
- name: Persist dist folder
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: release-dist
37+
path: dist/
38+
39+
test-pypi-publish:
40+
runs-on: ubuntu-latest
41+
needs:
42+
- release-build
43+
if: github.event_name == 'workflow_dispatch' && !github.event.inputs.dry_run
44+
environment:
45+
name: testpypi
46+
permissions:
47+
id-token: write
48+
49+
steps:
50+
- name: Retrieve dist folder
51+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
52+
with:
53+
name: release-dist
54+
path: dist/
55+
56+
- name: Publish release distributions to test.pypi.org
57+
# Using OIDC for PyPI publishing (no API tokens needed)
58+
# See: https://docs.github.com/en/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-pypi
59+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
60+
with:
61+
repository-url: https://test.pypi.org/legacy/
62+
63+
pypi-publish:
64+
runs-on: ubuntu-latest
65+
needs:
66+
- release-build
67+
if: github.event_name == 'release'
68+
environment:
69+
name: pypi
70+
permissions:
71+
id-token: write
72+
73+
steps:
74+
- name: Retrieve dist folder
75+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
76+
with:
77+
name: release-dist
78+
path: dist/
79+
80+
- name: Publish release distributions to test.pypi.org
81+
# Using OIDC for PyPI publishing (no API tokens needed)
82+
# See: https://docs.github.com/en/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-pypi
83+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0

.github/workflows/release.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)