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
61 changes: 61 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CD

on:
workflow_run:
workflows: ["CI"]
types:
- completed

jobs:
build:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'release'

container:
image: registry.access.redhat.com/ubi10/ubi:latest

steps:
- name: Check out code
uses: actions/checkout@v6
with:
ref: ${{ github.event.workflow_run.head_sha }}

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version-file: ".python-version"
version: "0.9.26"

- name: Build package
run: uv build

- name: Upload dist artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

publish-pypi:
runs-on: ubuntu-latest
needs: build

environment:
name: pypi
url: https://pypi.org/project/productmd/

permissions:
id-token: write # Required for trusted publishing

steps:
- name: Download dist artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# with:
# repository-url: https://test.pypi.org/legacy/
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ on:
- "pyproject.toml"
- "Containerfile.py36"
- ".github/workflows/ci.yml"
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
37 changes: 25 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,33 @@ This will generate the **source** and **wheel** packages under the `dist` direct

### Releasing

To release a new version:
To release a new version and publish to PyPI:

```bash
# Bump version in pyproject.toml
uv version <new_version>

# Commit, tag, and push
git add pyproject.toml
git commit -m "Bump version to <new_version>"
git tag <new_version>
git push origin master --tags
```
1. **Bump the version** in `pyproject.toml`:

```bash
uv version <new_version>
```

See [uv version docs](https://docs.astral.sh/uv/reference/cli/#uv-version) for other version commands (e.g., `uv version --bump minor`).

2. **Commit and push** the version change:

```bash
git add pyproject.toml uv.lock
git commit -m "Bump version to <new_version>"
git push origin master
```

3. **Create a GitHub release**:
- Go to [Releases](../../releases) and click **"Create a new release"**
- Pin the release to a tag following the format `vX.X` (e.g., `v1.0`, `v2.1`)
- Fill in the release title and notes
- Click **"Publish release"**

See [uv version docs](https://docs.astral.sh/uv/reference/cli/#uv-version) for other version commands (e.g., `uv version --bump minor`).
4. **Automated publishing**:
- Publishing the release triggers the CI pipeline
- If CI passes, the CD pipeline automatically builds and publishes the package to PyPI

## License

Expand Down