Skip to content

ci: automate releases with release-please#9

Open
manuel-alvarez-alvarez wants to merge 2 commits into
mainfrom
ci/release-automation
Open

ci: automate releases with release-please#9
manuel-alvarez-alvarez wants to merge 2 commits into
mainfrom
ci/release-automation

Conversation

@manuel-alvarez-alvarez
Copy link
Copy Markdown
Member

What does this PR do?

Wires up automated releases driven by release-please so that conventional-commit PR titles squash-merged into main produce versioned GitHub Releases with attached platform binaries.

After merge, release.yml will open and maintain a long-lived PR titled ci: release X.Y.Z. Merging that PR cuts the tag, creates the Release with auto-generated notes, builds the three platform tarballs, and attaches them (plus .sha256 sidecars) to the Release — which is what scripts/install.sh already expects.

Files added

  • release-please-config.json — Python release type, bump-minor-pre-major: true (pre-1.0 keeps majors suppressed), extra-files pinned to src/aiguard/__init__.py (auto-discovery would miss the no-separator path), PR title pattern ci: release \${version}.
  • .release-please-manifest.json — bootstrapped at 0.1.0.
  • .github/workflows/release.yml — runs release-please on push to main; on release_created invokes build.yml as a reusable workflow with release_tag.

Files modified

  • .github/workflows/build.yml — adds workflow_call with optional release_tag input; adds a gh release upload step guarded so it runs both when invoked by release.yml and when a v* tag is pushed manually (recovery path). Concurrency rekeyed so a main-branch run doesn't cancel the release-time run.
  • src/aiguard/__init__.py# x-release-please-version annotation on the __version__ line so the Generic updater catches it.
  • CONTRIBUTING.md — documents the conventional-commits requirement and the release flow.

Motivation

Today build.yml builds artifacts on tag push but never creates a GitHub Release or attaches assets — install.sh won't actually find anything to download until a human cuts the Release by hand. This PR removes that manual step and makes versioning + changelog generation deterministic from PR titles.

Why a reusable-workflow call instead of relying on the tag-push trigger?

GITHUB_TOKEN-created tag pushes do not trigger downstream workflows (GitHub safeguard against recursive runs). The reusable-workflow pattern avoids that footgun without requiring a PAT.

How was it tested?

  • python3 -c 'import json; json.load(open(\"release-please-config.json\")); json.load(open(\".release-please-manifest.json\"))' passes.
  • End-to-end smoke test will happen on merge: the first release.yml run on main should open a ci: release 0.2.0 PR (or 0.1.1 — depends on what counts as conventional since v0.1.0).
  • Manual recovery path (git tag v0.x.y && git push) still works because the existing push: tags: ["v*"] trigger is preserved and the upload step's if: guard covers both invocation modes.

Checklist

  • PR title follows Conventional Commits (ci:).
  • Tests cover the new behaviour — N/A (workflow-only change; verified by first release-please PR).
  • uv run ruff check src/ tests/ and uv run ruff format --check src/ tests/ pass (only __init__.py touched; comment annotation is line-format-stable).
  • No new runtime dependency.
  • New files include the Datadog header where applicable.

Follow-up (not in this PR)

  • Optional: add a PR-title lint (amannn/action-semantic-pull-request) to block non-conventional titles before they corrupt the CHANGELOG.
  • Consider suppressing build(deps): / build(deps-dev): from the CHANGELOG via changelog-sections if Dependabot noise becomes a problem.

@manuel-alvarez-alvarez manuel-alvarez-alvarez requested a review from a team as a code owner May 25, 2026 15:29
@manuel-alvarez-alvarez manuel-alvarez-alvarez force-pushed the ci/release-automation branch 3 times, most recently from b6ad0f9 to 7ddff3f Compare May 25, 2026 15:48
@manuel-alvarez-alvarez
Copy link
Copy Markdown
Member Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ddff3fada

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/build.yml Outdated
Adds release-please-driven release automation:

- release-please-config.json + .release-please-manifest.json drive
  Python-style version bumps (pre-1.0: feat -> minor, fix -> patch,
  feat!/BREAKING CHANGE -> minor) from conventional-commit PR titles
  squash-merged into main. pyproject.toml's version is updated by the
  Python strategy automatically; src/aiguard/__init__.py is pinned via
  extra-files (auto-discovery doesn't match the no-separator path) and
  bumped on the x-release-please-version annotation line.

- changelog-sections customizes the generated CHANGELOG with section
  headers: 🚀 Features, 🐛 Bug Fixes, ⏱️ Performance Improvements,
  ⏮️ Reverts, 📖 Documentation, ♻️ Code Refactoring. Build, CI,
  tests, chores, and styles are hidden — none of them move the
  version, and Dependabot's build(deps)/build(deps-dev) bumps would
  otherwise clutter release notes.

- .github/workflows/release.yml runs release-please on every push to
  main, maintaining an open PR titled "ci: release X.Y.Z" that bumps
  the version files and updates CHANGELOG.md. Merging that PR cuts a
  tag and creates a GitHub Release with auto-generated notes. The
  job mints a short-lived installation token from a dedicated GitHub
  App (via actions/create-github-app-token) rather than using the
  default GITHUB_TOKEN, so the release PR triggers pull_request
  checks — GITHUB_TOKEN-authored events do not. The App ID and
  private key are stored as RELEASE_PLEASE_APP_ID and
  RELEASE_PLEASE_APP_PRIVATE_KEY repo secrets.

- .github/workflows/build.yml learns a workflow_call trigger and a
  release_tag input. When release.yml invokes it after a release is
  cut, the existing platform build runs and a new step uploads the
  tarballs and SHA-256 sidecars to the GitHub Release. The tag-push
  trigger is preserved as a manual recovery path. We invoke build.yml
  as a reusable workflow rather than relying on tag-push side effects
  because GITHUB_TOKEN-created tag pushes don't trigger downstream
  workflows.

- CONTRIBUTING.md documents the conventional-commit PR title
  requirement, the release process, the bump table, and the manual
  recovery path.
Address Codex review comment on PR #9: `gh release upload` fails if no
Release exists for the tag. The release-please path is fine because
release-please creates the Release before the publish job runs, but the
manual recovery flow (`git push origin vX.Y.Z`) had no equivalent step
and would fail at upload time.

The upload step now `gh release view`s the tag and, if absent, runs
`gh release create --generate-notes` before uploading. `|| true`
tolerates the race where two matrix runners both miss the view and try
to create at once — one wins, the other harmlessly fails. The
release-please path is unaffected because the view succeeds and the
create branch is skipped entirely.

CONTRIBUTING.md updated: the manual recovery procedure is now just
"push the tag" — no separate "create the Release" step.
@manuel-alvarez-alvarez
Copy link
Copy Markdown
Member Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 386d1f2cde

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CONTRIBUTING.md
| `fix:` / `perf:` | patch | `0.1.0 → 0.1.1` |
| `feat:` | minor | `0.1.0 → 0.2.0` |
| `feat!:` / `BREAKING CHANGE:` body | minor | `0.1.0 → 0.2.0` |
| `chore:` / `docs:` / `ci:` / `test:`/ `refactor:` / `style:` | none | no release |
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Correct docs commit bump in release table

The new version-bump table says docs: commits produce “no release”, but this repository is configured with release-type: "python" in release-please-config.json, and release-please’s Python strategy treats docs commits as releasable units. As written, contributors will use docs: expecting no version change and still trigger release PR/version bumps, which makes the documented release contract inaccurate and can cause unexpected releases.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants