Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
24 changes: 24 additions & 0 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish Package (pypi)

on:
push:
tags:
- "v*"

jobs:
publish:
runs-on: ubuntu-latest
environment: pypi
permissions:
# IMPORTANT: this permission is mandatory for Trusted Publishing
id-token: write
steps:
- uses: actions/checkout@v4
- name: Install UV
uses: astral-sh/setup-uv@v6
- name: Install Dependencies
run: uv sync --locked --all-extras --dev
- name: Build Package
run: uv build --no-sources
- name: Publish Package to pypi
run: uv publish --index pypi
24 changes: 24 additions & 0 deletions .github/workflows/publish-testpypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish Package (testpypi)

on:
push:
tags:
- "test-v*"

jobs:
publish:
runs-on: ubuntu-latest
environment: testpypi
permissions:
# IMPORTANT: this permission is mandatory for Trusted Publishing
id-token: write
steps:
- uses: actions/checkout@v4
- name: Install UV
uses: astral-sh/setup-uv@v6
- name: Install Dependencies
run: uv sync --locked --all-extras --dev
- name: Build Package
run: uv build --no-sources
- name: Publish Package to testpypi
run: uv publish --index testpypi
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Changelog

## Unreleased (tbd)
## Unrelease (tbd)


## 0.4.2 (2025-09-12)
- #35 via MR #36 - Add security policy via `SECURITY.md`
- #33 via MR #38 - Switch to `uv` for package dependencies
- #34 via MR #40 - Switch to `uv` for building and publishing package
- #39 - Enhance publishing using GitHub actions and PyPI trusted publishers
- Chore/Docs: Drop official support for Python 3.9 (EOL October 2025)


Expand Down
34 changes: 19 additions & 15 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ When incrementing the:

## Publish Package Using UV

### Manual
## Using GitHub Actions

1. Update the `CHANGELOG.md` file. Move any `[Unreleased]` items into a version using an appropriate SemVer version (see above).

2. Bump the version number in the `pyproject.toml` using the `uv version` command below by providing a positional arugment. This is update the `pyproject.toml` file.

```bash
Expand All @@ -52,7 +53,22 @@ When incrementing the:

3. Commit the file changes to `main` and push to GitHub.

4. Build the package:
4. Create a new release and tag on GitHub:

1. Go to [Draft a new release](https://github.com/peterfarrell/django-heralder/releases/new)
2. Choose tag. If you have not created a tag yet, you can create one "on publish". Use the format of `vX.X.X`.
3. Set the release title to the version. Ex: `vX.X.X`
5. In the body for the release, copy the bullets of items from the `CHANGELOG.md`.

By creating a new git tag using the `vX.X.X` pattern, the GitHub Action in `.github/workflows/publish-pypi.yml` will automatically build and publish the new version of the package.

If you want to test publishing to Test PyPI, create a git tag using the `test-vX.X.X` pattern which will run the GitHub Action in `.github/workflows/publish-testpypi.yml`.

### If you have to do it manually

After preparing the release in steps 1-3 from above, continue to manually build and publish the package.

1. Build the package:

```bash
rm -rf dist/
Expand All @@ -61,22 +77,10 @@ When incrementing the:

* Use `--no-sources` when building to publish per [recommendatation from UV](https://docs.astral.sh/uv/guides/publish/#building-your-package)

5. Publish the package to `pypi` (production), or `testpypi` (test) package repository:
2. Publish the package to `pypi` (production), or `testpypi` (test) package repository:

```bash
uv publish --index [pypi|testpypi]
```

Follow the prompts for a API username `__token__` and password (API token). You can configure an API token in your PyPI account or Test PyPI account.

6. Create a new release and tag on GitHub:

1. Go to [Draft a new release](https://github.com/peterfarrell/django-heralder/releases/new)
2. Choose tag. If you have not created a tag yet, you can create one "on publish". Use the format of `vX.X.X`.
3. Set the release title to the version. Ex: `vX.X.X`
5. In the body for the release, copy the bullets of items from the `CHANGELOG.md`.


### Using GithHub Trusted Publisher

TODO: See [#39 - Enhance publishing using GitHub Actions and PyPI Trusted Publishers](https://github.com/peterfarrell/django-heralder/issues/39)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages = ["src/herald"]

[project]
name = "django-heralder"
version = "0.5.1"
version = "0.4.2"
requires-python = ">=3.10,<3.14"
readme = "README.md"
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.