You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit dfc1acf
Browse filesBrowse the repository at this point in the historyBrowse files
chore(ci): publish from the release run instead of a release-branch push (#254)
## Summary
- `publish.yml` is gone. Its job now runs inside `create-release.yml`
after `create-tag`, under the `production` environment, so the
required-reviewer prompt lands on the run just dispatched instead of on
a second workflow.
- The job checks out the release tag and verifies the version matches
the one the run cut before anything is built or uploaded.
- A failed publish is retried with **Re-run failed jobs** on that run;
the version and tag are already cut. A new release is only needed when
the code itself is at fault.
- The `/publish`, `/create-pr`, `/staged-review` and `/release-notes`
command docs describe the new flow.
## Before the next release
PyPI's trusted publisher for `robosystems-client` must list
`create-release.yml` with environment `production`. PyPI does not accept
a reusable workflow as a trusted publisher, which is why the job is
embedded rather than called. The `publish.yml` entry can be removed once
a release has gone through.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Copy file name to clipboardExpand all lines: .claude/commands/create-pr.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ The previous flow outsourced PR-description authoring to a GitHub Action that on
11
11
12
12
This is `robosystems-client` — a **published, post-1.0 Python SDK**, largely generated from the RoboSystems API's OpenAPI document and GraphQL schema. Its description is read by integrators deciding whether an upgrade is safe, so precision about the public surface matters more here than in an application repo.
13
13
14
-
**This repository is public.** The PR title and body are world-readable the moment they're pushed — and, because publishing is triggered by a push to `release/**` rather than by a merge, the text is often public well before the version that carries it. Treat the description as a publication.
14
+
**This repository is public.** The PR title and body are world-readable the moment they're pushed — and, because publishing happens only when a release is dispatched rather than on merge, the text is often public well before the version that carries it. Treat the description as a publication.
15
15
16
16
## Instructions
17
17
@@ -26,7 +26,7 @@ TARGET=${1:-main} # override target via the first argument
26
26
```
27
27
28
28
-**Never PR from the default branch.** If `CURRENT` is `main` (or `master`/`staging`), stop and tell the user to switch to a feature branch first. New branches are created via `just create-feature <type> <name>`, not by hand.
29
-
-**Never target a release branch.**`release/**` is what `publish.yml`watches; a PR into one is a publish trigger, not a code review. Target `main`.
29
+
-**Never target a release branch.**`release/<version>` is a cut record that `create-release.yml`tags and publishes from; a PR into one changes nothing on `main` and is not a code review. Target `main`.
30
30
-**Source ≠ target.** If `CURRENT == TARGET`, stop.
31
31
-**Uncommitted changes.** Run `git status --porcelain`. If there are uncommitted/staged changes, surface them and ask whether to commit them (respecting the repo's commit rules — never on `main`, stage files by name, no `git add -A`) or proceed without them. The PR description must reflect committed state.
32
32
-**Existing PR.** Check `gh pr list --head "$CURRENT" --base "$TARGET" --json url,number`. If a PR already exists, do **not** create a duplicate — offer to update its title/body with `gh pr edit` instead.
@@ -66,7 +66,7 @@ This is the whole point — ground the description in what actually happened:
66
66
67
67
A regeneration is not automatically additive: an API schema change can narrow a type or drop a field, and that reaches consumers as a break even though no hand-written line changed. Diff the emitted types before classifying.
68
68
69
-
-**Version and publish are not this PR's job.**`create-release.yml` bumps the version on `main` and cuts `release/<version>`; the push to that branch is what triggers `publish.yml`. Never bump the version in `pyproject.toml` in a feature PR and never imply the PR publishes anything.
69
+
-**Version and publish are not this PR's job.**`create-release.yml` bumps the version on `main` and cuts `release/<version>`, tags it, and publishes from the tag in the same run. Never bump the version in `pyproject.toml` in a feature PR and never imply the PR publishes anything.
70
70
71
71
-**Security-fix disclosure.** If the PR fixes a security issue, the prose is often _more_ actionable than the diff — keep it terse and non-actionable. Name the area hardened, never the mechanism. No exploit mechanics, attack scenarios, endpoint enumerations, or payloads. For coordinated disclosure use a private GitHub Security Advisory, never a public issue.
Copy file name to clipboardExpand all lines: .claude/commands/publish.md
+11-9Lines changed: 11 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,12 +7,13 @@ Monitor a release and publish run — pinpoint why it failed, and confirm the ve
7
7
8
8
## How a release actually happens here
9
9
10
-
Two workflows, and the trigger between them is the part that surprises people:
10
+
One workflow, `create-release.yml` (`workflow_dispatch`, or `bin/create-release.sh`), with three jobs in sequence:
11
11
12
-
1.**`create-release.yml`** (`workflow_dispatch`, or `bin/create-release.sh`) — reads the current version from `pyproject.toml`, computes the next one from the requested bump, commits the bump **to `main`**, cuts `release/<version>` from that commit, and tags it.
13
-
2.**`publish.yml`** — triggered by **a push to `release/**`**, not by a merge and not by the tag. It reads the version from `pyproject.toml`, builds the distribution, checks the PyPI JSON API for that version, and if it isn't there, publishes over OIDC trusted publishing.
12
+
1.**`create-release`** — reads the current version from `pyproject.toml`, computes the next one from the requested bump, commits the bump **to `main`**, and cuts `release/<version>` from that commit.
13
+
2.**`create-tag`** — `tag-release.yml` tags that branch and cuts the GitHub Release.
14
+
3.**`publish`** — runs once the tag exists, under the `production` environment, so its required-reviewer prompt lands on this same run. It checks out the tag, verifies the version is the one just cut, builds the distribution, checks the PyPI JSON API for that version, and if it isn't there, publishes over OIDC trusted publishing. PyPI's trusted publisher is registered against `create-release.yml` and the `production` environment.
14
15
15
-
So: **merging a PR to `main` publishes nothing.**The release branch push is the publishing event. And because `publish.yml` short-circuits when the version already exists on PyPI, a re-run of a successful publish is a no-op rather than an error — useful, but it also means "the run went green" is not by itself proof that _this_run published anything. Note the build step runs *before*the existence check, so a green build tells you nothing about whether a publish happened.
16
+
So: **merging a PR to `main` publishes nothing.**Dispatching the workflow is the publishing event, and nothing uploads until the deployment is approved on the run page. A failed publish is retried with **Re-run failed jobs** on that run — the version and tag are already cut, and a new release is warranted only when the code itself is at fault. The job refuses a version that already exists on PyPI, so a re-run after a successful upload fails at the existence check rather than uploading twice. Note the build step runs *before*that check, so a green build tells you nothing about whether a publish happened.
16
17
17
18
`tag-release.yml` writes the GitHub release body separately; see `/release-notes` for the curated-notes override.
18
19
@@ -26,7 +27,6 @@ So: **merging a PR to `main` publishes nothing.** The release branch push is the
26
27
## 1. Find the run
27
28
28
29
```bash
29
-
gh run list --workflow=publish.yml --limit 5
30
30
gh run list --workflow=create-release.yml --limit 5
31
31
gh run view <run-id>
32
32
gh run watch <run-id># live, if it's in flight
@@ -42,9 +42,11 @@ Classify by stage:
42
42
43
43
-**`create-release.yml` — branch already exists.** The workflow checks for `release/<version>` before creating it. A failure here usually means a previous run got partway, and the fix is to resolve the leftover branch, not to re-dispatch blindly.
44
44
-**`create-release.yml` — push to `main` rejected.** The version bump commits directly to a protected branch and needs `ACTIONS_TOKEN`; a permissions failure here looks like an auth error at the push step.
45
-
-**`publish.yml` — "version exists on PyPI".** Not a failure. The upload step is skipped by condition. Read it as "nothing to do," and if you expected a publish, the version wasn't bumped.
46
-
-**`publish.yml` — build.**`pip install build twine` then `python -m build`. A build failure here is a packaging problem — usually `pyproject.toml` metadata or a missing file — that the test suite does not cover, since `just test-all` never builds a distribution.
47
-
-**`publish.yml` — the upload.** OIDC trusted publishing. Failures are usually the PyPI-side trusted-publisher configuration (environment or workflow name mismatch) rather than anything in the code.
45
+
-**`publish` — waiting.** The job is paused on the `production` environment's required reviewer. Nothing is wrong; approve it from the run page (_Review deployments_).
46
+
-**`publish` — "checked out version X, expected Y".** The tag the job checked out does not carry the version this run cut. Nothing was uploaded; look at what `create-tag` tagged.
47
+
-**`publish` — "version exists on PyPI".** The job fails at the existence check and uploads nothing. After a successful publish this is the expected result of a re-run; otherwise the version wasn't bumped.
48
+
-**`publish` — build.**`pip install build twine` then `python -m build`. A build failure here is a packaging problem — usually `pyproject.toml` metadata or a missing file — that the test suite does not cover, since `just test-all` never builds a distribution.
49
+
-**`publish` — the upload.** OIDC trusted publishing. Failures are usually the PyPI-side trusted-publisher configuration (the publisher must name `create-release.yml` and the `production` environment) rather than anything in the code.
48
50
49
51
## 3. Verify it actually landed
50
52
@@ -68,6 +70,6 @@ If the version is a major, downstream consumers need coordinated adoption — sa
68
70
69
71
## Output
70
72
71
-
A short status: which workflow, what failed and at which step, the root cause, the re-run link if any, and the verified published version from PyPI. If nothing failed, say so — don't manufacture work.
73
+
A short status: which job, what failed and at which step, the root cause, the re-run link if any, and the verified published version from PyPI. If nothing failed, say so — don't manufacture work.
The file must exist **at the tagged ref**, and there is no window to add it late: `create-release.yml` bumps the version on `main`, cuts `release/<version>` from the result, and tags it in the same run. Pushing that release branch is also what triggers `publish.yml`, so by the time the package is on PyPI the notes are already fixed. They have to be **merged into `main` before the workflow is dispatched**.
63
+
The file must exist **at the tagged ref**, and there is no window to add it late: `create-release.yml` bumps the version on `main`, cuts `release/<version>` from the result, and tags it in the same run. The same run then publishes from that tag, so by the time the package is on PyPI the notes are already fixed. They have to be **merged into `main` before the workflow is dispatched**.
64
64
65
65
Write the draft on a feature branch (created via `just create-feature`), never on `main`. Present it for review and leave the merge and the dispatch to the user.
Copy file name to clipboardExpand all lines: .claude/commands/staged-review.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ Post-1.0, the emitted type surface **is** the contract. For anything staged here
47
47
## Packaging
48
48
49
49
- Changes to `pyproject.toml` — dependency pins, optional extras, `requires-python`, included packages, `py.typed` — change **what ships and who can install it**. A dropped `py.typed` silently turns a typed SDK into an untyped one for every consumer; a narrowed `requires-python` locks out supported versions (3.11–3.13).
50
-
- Never stage a version bump in `pyproject.toml` in a feature branch: `create-release.yml` owns the bump on `main`, and pushing `release/**` is what triggers `publish.yml`.
50
+
- Never stage a version bump in `pyproject.toml` in a feature branch: `create-release.yml` owns the bump on `main` and publishes from the tag it cuts.
echo "The PyPI package will be automatically published when the release tag is created." >> $GITHUB_STEP_SUMMARY
159
-
echo "" >> $GITHUB_STEP_SUMMARY
160
-
echo "Monitor the publish workflow: [View Workflows](https://github.com/RoboFinSystems/robosystems-python-client/actions/workflows/publish.yml)" >> $GITHUB_STEP_SUMMARY
228
+
229
+
if [ "${{ needs.publish.result }}" != "success" ]; then
230
+
echo "" >> $GITHUB_STEP_SUMMARY
231
+
echo "The version and tag are cut but the package is not on PyPI. Fix the cause, then **Re-run failed jobs** on this run; a new release is only needed when the code itself is at fault." >> $GITHUB_STEP_SUMMARY
0 commit comments