Skip to content

Commit 55dd604

Browse files
chore: automate release process
1 parent 0c14426 commit 55dd604

File tree

5 files changed

+240
-102
lines changed

5 files changed

+240
-102
lines changed

.github/maintainers_guide.md

Lines changed: 129 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ this project. If you use this package within your own software as is but don't p
1010

1111
We recommend using [pyenv](https://github.com/pyenv/pyenv) for Python runtime management. If you use macOS, follow the following steps:
1212

13-
```bash
13+
```sh
1414
$ brew update
1515
$ brew install pyenv
1616
```
1717

1818
Install necessary Python runtimes for development/testing. You can rely on GitHub Actions workflows for testing with various major versions. <https://github.com/slackapi/bolt-python/tree/main/.github/workflows>
1919

20-
```bash
20+
```sh
2121
$ pyenv install -l | grep -v "-e[conda|stackless|pypy]"
2222

2323
$ pyenv install 3.8.5 # select the latest patch version
@@ -34,7 +34,7 @@ $ pyenv rehash
3434

3535
Then, you can create a new Virtual Environment this way:
3636

37-
```bash
37+
```sh
3838
$ python -m venv env_3.8.5
3939
$ source env_3.8.5/bin/activate
4040
```
@@ -49,27 +49,27 @@ If you make some changes to this SDK, please write corresponding unit tests as m
4949

5050
If this is your first time to run tests, although it may take a bit long time, running the following script is the easiest.
5151

52-
```bash
52+
```sh
5353
$ ./scripts/install_all_and_run_tests.sh
5454
```
5555

5656
Once you installed all the required dependencies, you can use the following one.
5757

58-
```bash
58+
```sh
5959
$ ./scripts/run_tests.sh
6060
```
6161

6262
Also, you can run a single test this way.
6363

64-
```bash
64+
```sh
6565
$ ./scripts/run_tests.sh tests/scenario_tests/test_app.py
6666
```
6767

6868
#### Run the Samples
6969

7070
If you make changes to `slack_bolt/adapter/*`, please verify if it surely works by running the apps under `examples` directory.
7171

72-
```bash
72+
```sh
7373
# Install all optional dependencies
7474
$ pip install -r requirements/adapter.txt
7575
$ pip install -r requirements/adapter_testing.txt
@@ -97,115 +97,154 @@ If you want to test the package locally you can.
9797

9898
1. Build the package locally
9999
- Run
100-
```bash
100+
```sh
101101
scripts/build_pypi_package.sh
102102
```
103103
- This will create a `.whl` file in the `./dist` folder
104104
2. Use the built package
105105
- Example `/dist/slack_bolt-1.2.3-py2.py3-none-any.whl` was created
106106
- From anywhere on your machine you can install this package to a project with
107-
```bash
107+
```sh
108108
pip install <project path>/dist/slack_bolt-1.2.3-py2.py3-none-any.whl
109109
```
110110
- It is also possible to include `slack_bolt @ file:///<project path>/dist/slack_bolt-1.2.3-py2.py3-none-any.whl` in a [requirements.txt](https://pip.pypa.io/en/stable/user_guide/#requirements-files) file
111111

112-
### Releasing
113-
114-
#### Generate API reference documents
112+
### Generate API reference documents
115113

116-
```bash
114+
```sh
117115
./scripts/generate_api_docs.sh
118116
```
119117

118+
### Releasing
119+
120120
#### test.pypi.org deployment
121121

122-
##### $HOME/.pypirc
122+
[TestPyPI](https://test.pypi.org/) is a separate instance of the Python Package
123+
Index that allows you to try distribution tools and processes without affecting
124+
the real index. This is particularly useful when making changes related to the
125+
package configuration itself, for example, modifications to the `pyproject.toml` file.
126+
127+
You can deploy this project to TestPyPI using GitHub Actions.
128+
129+
To deploy using GitHub Actions:
123130

124-
```toml
125-
[testpypi]
126-
username: {your username}
127-
password: {your password}
131+
1. Push your changes to a branch or tag
132+
2. Navigate to <https://github.com/slackapi/bolt-python/actions/workflows/pypi-release.yml>
133+
3. Click on "Run workflow"
134+
4. Select your branch or tag from the dropdown
135+
5. Click "Run workflow" to build and deploy your branch to TestPyPI
136+
137+
Alternatively, you can deploy from your local machine with:
138+
139+
```sh
140+
./scripts/deploy_to_test_pypi.sh
128141
```
129142

130143
#### Development Deployment
131144

145+
Deploying a new version of this library to Pypi is triggered by publishing a Github Release.
146+
Before creating a new release, ensure that everything on a stable branch has
147+
landed, then [run the tests](#run-all-the-unit-tests).
148+
132149
1. Create a branch in which the development release will live:
133-
- Bump the version number in adherence to [Semantic Versioning](http://semver.org/) and [Developmental Release](https://peps.python.org/pep-0440/#developmental-releases) in `slack_bolt/version.py`
134-
- Example the current version is `1.2.3` a proper development bump would be `1.3.0.dev0`
135-
- `.dev` will indicate to pip that this is a [Development Release](https://peps.python.org/pep-0440/#developmental-releases)
136-
- Note that the `dev` version can be bumped in development releases: `1.3.0.dev0` -> `1.3.0.dev1`
137-
- Commit with a message including the new version number. For example `1.3.0.dev0` & Push the commit to a branch where the development release will live (create it if it does not exist)
138-
- `git checkout -b future-release`
139-
- `git commit -m 'version 1.3.0.dev0'`
140-
- `git push future-release`
141-
- Create a git tag for the release. For example `git tag v1.3.0.dev0`.
142-
- Push the tag up to github with `git push origin --tags`
143-
144-
2. Distribute the release
145-
- Use the latest stable Python runtime
146-
- `python -m venv .venv`
147-
- `./scripts/deploy_to_pypi_org.sh`
148-
- You do not need to create a GitHub release
149-
150-
3. (Slack Internal) Communicate the release internally
150+
- Bump the version number in adherence to
151+
[Semantic Versioning](http://semver.org/) and
152+
[Developmental Release](https://peps.python.org/pep-0440/#developmental-releases)
153+
in `slack_bolt/version.py`
154+
- Example the current version is `1.2.3` a proper development bump would be
155+
`1.2.3.dev0`
156+
- `.dev` will indicate to pip that this is a
157+
[Development Release](https://peps.python.org/pep-0440/#developmental-releases)
158+
- Note that the `dev` version can be bumped in development releases:
159+
`1.2.3.dev0` -> `1.2.3.dev1`
160+
- Build the docs with `./scripts/generate_api_docs.sh`.
161+
- Commit with a message including the new version number. For example
162+
`1.2.3.dev0` & Push the commit to a branch where the development release
163+
will live (create it if it does not exist)
164+
- `git checkout -b future-release`
165+
- `git commit -m 'version 1.2.3.dev0'`
166+
- `git push -u origin future-release`
167+
2. Create a new GitHub Release from the
168+
[Releases page](https://github.com/slackapi/bolt-python/releases) by
169+
clicking the "Draft a new release" button.
170+
3. Input the version manually into the "Choose a tag" input. You must use the
171+
same version found in `slack_bolt/version.py`
172+
173+
- After you input the new version, click the "Create a new tag: x.x.x on
174+
publish" button. This won't create your tag immediately.
175+
- Auto-generate the release notes by clicking the "Auto-generate release
176+
notes" button. This will pull in changes that will be included in your
177+
release.
178+
- Edit the resulting notes to ensure they have decent messaging that are
179+
understandable by non-contributors, but each commit should still have it's
180+
own line.
181+
- Ensure that this version adheres to
182+
[semantic versioning](http://semver.org/) and
183+
[Developmental Release](https://peps.python.org/pep-0440/#developmental-releases).
184+
See [Versioning](#versioning-and-tags) for correct version format.
185+
186+
4. Set the "Target" input to the feature branch with the development changes.
187+
5. Name the release title after the version tag. It should match the updated
188+
value from `slack_bolt/version.py`!
189+
6. Make any adjustments to generated release notes to make sure they are
190+
accessible and approachable and that an end-user with little context about
191+
this project could still understand.
192+
7. Select "Set as a pre-release"
193+
8. Publish the release by clicking the "Publish release" button!
194+
9. After a few minutes, the corresponding version will be available on
195+
<https://github.com/slackapi/bolt-python/>.
196+
10. (Slack Internal) Communicate the release internally
151197

152198
#### Production Deployment
153199

154-
1. Create the commit for the release:
155-
- Bump the version number in adherence to [Semantic Versioning](http://semver.org/) in `slack_bolt/version.py`
200+
Deploying a new version of this library to Pypi is triggered by publishing a Github Release.
201+
Before creating a new release, ensure that everything on the `main` branch since
202+
the last tag is in a releasable state! At a minimum,
203+
[run the tests](#run-all-the-unit-tests).
204+
205+
1. Create the commit for the release
206+
- Bump the version number in adherence to
207+
[Semantic Versioning](http://semver.org/) in `slack_bolt/version.py`.
156208
- Build the docs with `./scripts/generate_api_docs.sh`.
157-
- Commit with a message including the new version number. For example `1.2.3` & Push the commit to a branch and create a PR to sanity check.
158-
- `git checkout -b v1.2.3`
159-
- `git commit -a -m 'version 1.2.3'`
160-
- `git push -u origin HEAD`
161-
- Open a PR and merge after receiving at least one approval from other maintainers.
162-
163-
2. Distribute the release
164-
- Use the latest stable Python runtime
165-
- `git checkout main && git pull`
166-
- `python --version`
167-
- `python -m venv .venv`
168-
- `./scripts/deploy_to_pypi_org.sh`
169-
- Create a new GitHub Release from the [Releases page](https://github.com/slackapi/bolt-python/releases) by clicking the "Draft a new release" button.
170-
- Enter the new version number updated from the commit (e.g. `v1.2.3`) into the "Choose a tag" input.
171-
- Ensure the tag `Target` branch is `main` (e.g `Target:main`).
172-
- Click the "Create a new tag: x.x.x on publish" button. This won't create your tag immediately.
173-
- Name the release after the version number updated from the commit (e.g. `version 1.2.3`)
174-
- Auto-generate the release notes by clicking the "Auto-generate release
175-
notes" button. This will pull in changes that will be included in your
176-
release.
177-
- Edit the resulting notes to ensure they have decent messaging that are
178-
understandable by non-contributors, but each commit should still have it's
179-
own line.
180-
- Ensure that this version adheres to [semantic versioning](http://semver.org/). See
181-
[Versioning](#versioning-and-tags) for correct version format. Version tags
182-
should match the following pattern: `v2.5.0`.
183-
184-
```markdown
185-
## New Features
186-
187-
### Awesome Feature 1
188-
189-
Description here.
190-
191-
### Awesome Feature 2
192-
193-
Description here.
194-
195-
## Changes
196-
197-
* #123 Make it better - thanks @SlackHQ
198-
* #123 Fix something wrong - thanks @seratch
199-
```
200-
201-
3. (Slack Internal) Communicate the release internally
202-
- Include a link to the GitHub release
203-
204-
4. Make announcements
205-
- #tools-bolt in community.slack.com
206-
207-
5. (Slack Internal) Tweet by @SlackAPI
208-
- Not necessary for patch updates, might be needed for minor updates, definitely needed for major updates. Include a link to the GitHub release
209+
- Commit with a message including the new version number. For example `1.2.3`
210+
& Push the commit to a branch and create a PR to sanity check.
211+
- `git checkout -b 1.2.3-release`
212+
- `git commit -m 'chore(release): tag version 1.2.3'`
213+
- `git push {your-fork} 1.2.3-release`
214+
- Add relevant labels to the PR and add the PR to a GitHub Milestone.
215+
- Merge in release PR after getting an approval from at least one maintainer.
216+
2. Create a new GitHub Release from the
217+
[Releases page](https://github.com/slackapi/bolt-python/releases) by
218+
clicking the "Draft a new release" button.
219+
3. Input the version manually into the "Choose a tag" input. You must use the
220+
same version found in `slack_bolt/version.py`
221+
222+
- After you input the version, click the "Create a new tag: x.x.x on publish"
223+
button. This won't create your tag immediately.
224+
- Click the "Auto-generate release notes" button. This will pull in changes
225+
that will be included in your release.
226+
- Edit the resulting notes to ensure they have decent messaging that are
227+
understandable by non-contributors, but each commit should still have it's
228+
own line.
229+
- Ensure that this version adheres to
230+
[semantic versioning](http://semver.org/). See
231+
[Versioning](#versioning-and-tags) for correct version format.
232+
233+
4. Set the "Target" input to the "main" branch.
234+
5. Name the release title after the version tag. It should match the updated
235+
value from `slack_bolt/version.py`!
236+
6. Make any adjustments to generated release notes to make sure they are
237+
accessible and approachable and that an end-user with little context about
238+
this project could still understand.
239+
7. Publish the release by clicking the "Publish release" button!
240+
8. After a few minutes, the corresponding version will be available on
241+
<https://pypi.org/project/slack-bolt/>.
242+
9. Close the current GitHub Milestone and create one for the next minor version.
243+
10. (Slack Internal) Communicate the release internally
244+
- Include a link to the GitHub release
245+
11. (Slack Internal) Tweet by @SlackAPI
246+
- Not necessary for patch updates, might be needed for minor updates,
247+
definitely needed for major updates. Include a link to the GitHub release
209248

210249
## Workflow
211250

.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+
- "*"

0 commit comments

Comments
 (0)