Skip to content

Commit 57c5e39

Browse files
WilliamBergamingithub-advanced-security[bot]zimeg
authored
chore: simplify the release process (#72)
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Co-authored-by: Eden Zimbelman <[email protected]>
1 parent edacafa commit 57c5e39

File tree

4 files changed

+133
-49
lines changed

4 files changed

+133
-49
lines changed

.github/maintainers_guide.md

Lines changed: 24 additions & 15 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-
```zsh
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 for testing with various major versions.
1919

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

2323
pyenv install 3.9.18 # 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-
```zsh
37+
```sh
3838
python -m venv env_3.9.18
3939
source env_3.9.18/bin/activate
4040
```
@@ -49,38 +49,38 @@ If you make some changes to this project, please write corresponding unit tests
4949

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

52-
```zsh
52+
```sh
5353
./scripts/install_and_run_tests.sh
5454
```
5555

5656
To simply install all the development dependencies for this project.
5757

58-
```zsh
58+
```sh
5959
./scripts/install.sh
6060
```
6161

6262
Once you installed all the required dependencies, you can use the following.
6363

64-
```zsh
64+
```sh
6565
./scripts/run_tests.sh
6666
./scripts/run_tests.sh tests/scenario_test/test_get_hooks.py
6767
```
6868

6969
To format this project
7070

71-
```zsh
71+
```sh
7272
./scripts/format.sh
7373
```
7474

7575
To lint this project
7676

77-
```zsh
77+
```sh
7878
./scripts/lint.sh
7979
```
8080

8181
This project uses [mypy](https://mypy.readthedocs.io/en/stable/index.html) to check and infers types for your Python code.
8282

83-
```zsh
83+
```sh
8484
./scripts/run_mypy.sh
8585
```
8686

@@ -92,7 +92,7 @@ If you want to test the package locally you can.
9292

9393
- Run
9494

95-
```zsh
95+
```sh
9696
scripts/build_pypi_package.sh
9797
```
9898

@@ -103,7 +103,7 @@ If you want to test the package locally you can.
103103
- Example `/dist/slack_cli_hooks-1.2.3-py2.py3-none-any.whl` was created
104104
- From anywhere on your machine you can install this package to a project with
105105

106-
```zsh
106+
```sh
107107
pip install <project path>/dist/slack_cli_hooks-1.2.3-py2.py3-none-any.whl
108108
```
109109

@@ -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:
122122

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:
130+
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: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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+
permissions:
19+
contents: read
20+
21+
steps:
22+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
23+
with:
24+
persist-credentials: false
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
28+
with:
29+
python-version: "3.x"
30+
31+
- name: Build release distributions
32+
run: |
33+
scripts/build_pypi_package.sh
34+
35+
- name: Persist dist folder
36+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
37+
with:
38+
name: release-dist
39+
path: dist/
40+
41+
test-pypi-publish:
42+
runs-on: ubuntu-latest
43+
needs:
44+
- release-build
45+
if: ${{ github.event_name == 'workflow_dispatch' && !github.event.inputs.dry_run }}
46+
environment:
47+
name: testpypi
48+
permissions:
49+
id-token: write
50+
51+
steps:
52+
- name: Retrieve dist folder
53+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
54+
with:
55+
name: release-dist
56+
path: dist/
57+
58+
- name: Publish release distributions to test.pypi.org
59+
# Using OIDC for PyPI publishing (no API tokens needed)
60+
# See: https://docs.github.com/en/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-pypi
61+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
62+
with:
63+
repository-url: https://test.pypi.org/legacy/
64+
65+
pypi-publish:
66+
runs-on: ubuntu-latest
67+
needs:
68+
- release-build
69+
if: ${{ github.event_name == 'release' }}
70+
environment:
71+
name: pypi
72+
permissions:
73+
id-token: write
74+
75+
steps:
76+
- name: Retrieve dist folder
77+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
78+
with:
79+
name: release-dist
80+
path: dist/
81+
82+
- name: Publish release distributions to test.pypi.org
83+
# Using OIDC for PyPI publishing (no API tokens needed)
84+
# See: https://docs.github.com/en/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-pypi
85+
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)