Skip to content

Commit 10c790b

Browse files
ci(release): automate release PRs and tag creation
Why - Reduce manual release steps and avoid hand-created tags. - Align the repository with a professional, bot-driven release workflow. What changed - Added Release Please workflow to run on pushes to main and manual dispatch. - Added .release-please-config.json and .release-please-manifest.json for python package versioning and v-prefixed tags. - Configured Release Please to use RELEASE_PLEASE_TOKEN with a GITHUB_TOKEN fallback. - Removed legacy .github/workflows/release.yml to prevent duplicate/racing GitHub release creation. - Updated README release documentation to describe the new release-PR flow and one-time token setup. - Synced SNAPSHOT.md for the new root-level release metadata files. Impact - Release tags and GitHub releases are now created automatically by merging the release PR. - Existing publish-pypi workflow remains tag-driven and continues to publish from release tags. Tests - Parsed new workflow/config files successfully (YAML/JSON parse checks). - Validated tag/version metadata helper with: PYTHONPATH=src python -m agentrules.core.utils.release_metadata --tag v3.4.2. Notes - Repository secret RELEASE_PLEASE_TOKEN still needs to be configured in GitHub settings for reliable downstream workflow triggering from bot-created tags.
1 parent 5f82bd2 commit 10c790b

6 files changed

Lines changed: 55 additions & 48 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
issues: write
12+
pull-requests: write
13+
14+
concurrency:
15+
group: release-please-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
release-please:
20+
name: Open Release PR / Publish Release
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Run release-please
24+
id: release
25+
uses: googleapis/release-please-action@v4
26+
with:
27+
token: ${{ secrets.RELEASE_PLEASE_TOKEN || secrets.GITHUB_TOKEN }}
28+
config-file: .release-please-config.json
29+
manifest-file: .release-please-manifest.json

.github/workflows/release.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.release-please-config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"packages": {
4+
".": {
5+
"release-type": "python",
6+
"package-name": "agentrules",
7+
"include-v-in-tag": true,
8+
"changelog-path": "CHANGELOG.md"
9+
}
10+
}
11+
}

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "3.4.1"
3+
}

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -336,18 +336,21 @@ Toggle outputs with `agentrules configure --outputs` or via the config TOML.
336336
- Run targeted tests: `python tests/phase_3_test/run_test.py`
337337
- Deterministic smoke runs (CI/local without API calls): `agentrules analyze --offline tests/tests_input`
338338
- Full suite: `python -m unittest discover tests -v`
339-
- Releases are tag-driven: bump `[project].version` in `pyproject.toml`, commit, create matching `vX.Y.Z` tag, and push it.
339+
- Releases are Release Please-driven: merges to `main` update/open a release PR, and merging that PR creates the `vX.Y.Z` tag + GitHub release automatically.
340340
- GitHub Actions now publishes package artifacts with Trusted Publishing (OIDC) via `.github/workflows/publish-pypi.yml` (no long-lived PyPI API token).
341-
- Run a safe preflight publish first from Actions with `workflow_dispatch` and `repository = testpypi`; publish to production PyPI on tag push or manual `repository = pypi`.
341+
- Run a safe preflight publish first from Actions with `workflow_dispatch` and `repository = testpypi`; publish to production PyPI on release-tag push or manual `repository = pypi`.
342342
- Keep docs and presets in sync when adding providers (`config/agents.py`, `config/tools.py`, `core/agents/*`).
343343

344344
### Release Process (PyPI)
345345

346-
1. Update `[project].version` in `pyproject.toml`, then commit and push.
347-
2. Run `.github/workflows/publish-pypi.yml` manually with `repository = testpypi` to validate package upload first.
348-
3. Create and push matching tag `vX.Y.Z` to trigger Trusted Publishing to PyPI.
349-
4. The same tag also triggers `.github/workflows/release.yml` for GitHub Release artifact/notes.
350-
5. One-time setup for new projects: configure Trusted Publishers on TestPyPI and PyPI for repository `trevor-nichols/agentrules-architect`, workflow `.github/workflows/publish-pypi.yml`, and environments `testpypi`/`pypi`.
346+
1. Merge feature PRs into `main` using Conventional Commit-style titles/messages (for example `feat: ...`, `fix: ...`).
347+
2. `.github/workflows/release-please.yml` updates or opens a release PR with the version bump and changelog.
348+
3. (Optional, recommended) run `.github/workflows/publish-pypi.yml` manually with `repository = testpypi` from the release PR head commit.
349+
4. Merge the release PR. Release Please creates/pushes the matching `vX.Y.Z` tag and publishes a GitHub release.
350+
5. The tag push triggers `.github/workflows/publish-pypi.yml` to publish to production PyPI.
351+
6. One-time setup for new projects:
352+
- Configure a repo secret `RELEASE_PLEASE_TOKEN` (PAT or GitHub App token) with permission to create/update PRs, tags, and releases. This ensures tag pushes from Release Please trigger downstream workflows.
353+
- Configure Trusted Publishers on TestPyPI and PyPI for repository `trevor-nichols/agentrules-architect`, workflow `.github/workflows/publish-pypi.yml`, and environments `testpypi`/`pypi`.
351354

352355
## 🤝 Contributing
353356

SNAPSHOT.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,8 @@
419419
│ │ └── __init__.pyi # Type stub init
420420
│ └── tomli_w/ # Type stubs for tomli_w module
421421
│ └── __init__.pyi # Type stub init
422+
├── .release-please-config.json
423+
├── .release-please-manifest.json
422424
├── conftest.py # pytest configuration, sets up live test markers
423425
├── CONTRIBUTING.md
424426
├── pyproject.toml # Python project metadata and dependencies

0 commit comments

Comments
 (0)