Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 24 additions & 15 deletions .github/maintainers_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ this project. If you use this package within your own software as is but don't p

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

```zsh
```sh
brew update
brew install pyenv
```

Install necessary Python runtimes for development/testing. You can rely on GitHub Actions for testing with various major versions.

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

pyenv install 3.9.18 # select the latest patch version
Expand All @@ -34,7 +34,7 @@ pyenv rehash

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

```zsh
```sh
python -m venv env_3.9.18
source env_3.9.18/bin/activate
```
Expand All @@ -49,38 +49,38 @@ If you make some changes to this project, please write corresponding unit tests

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

```zsh
```sh
./scripts/install_and_run_tests.sh
```

To simply install all the development dependencies for this project.

```zsh
```sh
./scripts/install.sh
```

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

```zsh
```sh
./scripts/run_tests.sh
./scripts/run_tests.sh tests/scenario_test/test_get_hooks.py
```

To format this project

```zsh
```sh
./scripts/format.sh
```

To lint this project

```zsh
```sh
./scripts/lint.sh
```

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

```zsh
```sh
./scripts/run_mypy.sh
```

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

- Run

```zsh
```sh
scripts/build_pypi_package.sh
```

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

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

Expand All @@ -113,13 +113,22 @@ If you want to test the package locally you can.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⭐ praise: Nice! These notes are so useful for the unfamiliar reader!


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

```zsh
To deploy using GitHub Actions:

1. Push your changes to a branch or tag
2. Navigate to <https://github.com/slackapi/python-slack-hooks/actions/workflows/pypi-release.yml>
3. Click on "Run workflow"
4. Select your branch or tag from the dropdown
5. Click "Run workflow" to build and deploy your branch to TestPyPI

Alternatively, you can deploy from your local machine with:

```sh
./scripts/deploy_to_test_pypi.sh
```

Expand Down
24 changes: 24 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuring-automatically-generated-release-notes
changelog:
categories:
- title: 🚀 Enhancements
labels:
- enhancement
- title: 🐛 Bug Fixes
labels:
- bug
- title: 📚 Documentation
labels:
- docs
Comment on lines +10 to +12
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 note: Not all of our projects have matching labels at the moment... I believe we're moving toward "docs" but we might want to follow up later to make sure projects match here!

- title: 🤖 Build
labels:
- build
- title: 🧪 Testing/Code Health
labels:
- code health
- title: 🔒 Security
labels:
- security
- title: 📦 Other changes
labels:
- "*"
85 changes: 85 additions & 0 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Upload A Release to pypi.org or test.pypi.org

on:
release:
types:
- published
workflow_dispatch:
inputs:
dry_run:
description: "Dry run (build only, do not publish)"
required: false
type: boolean
default: false

jobs:
release-build:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: "3.x"

- name: Build release distributions
run: |
scripts/build_pypi_package.sh
- name: Persist dist folder
uses: actions/upload-artifact@v4
with:
name: release-dist
path: dist/

test-pypi-publish:
runs-on: ubuntu-latest
needs:
- release-build
if: github.event_name == 'workflow_dispatch' && !github.event.inputs.dry_run
environment:
name: testpypi
permissions:
id-token: write

steps:
- name: Retrieve dist folder
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
name: release-dist
path: dist/

- name: Publish release distributions to test.pypi.org
# Using OIDC for PyPI publishing (no API tokens needed)
# See: https://docs.github.com/en/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-pypi
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
repository-url: https://test.pypi.org/legacy/

pypi-publish:
runs-on: ubuntu-latest
needs:
- release-build
if: github.event_name == 'release'
environment:
name: pypi
permissions:
id-token: write

steps:
- name: Retrieve dist folder
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
name: release-dist
path: dist/

- name: Publish release distributions to test.pypi.org
# Using OIDC for PyPI publishing (no API tokens needed)
# See: https://docs.github.com/en/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-pypi
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
34 changes: 0 additions & 34 deletions .github/workflows/release.yml

This file was deleted.