Skip to content

Commit 53f2ef4

Browse files
committed
PR based flow
1 parent aa60336 commit 53f2ef4

1 file changed

Lines changed: 29 additions & 27 deletions

File tree

CONTRIBUTING.md

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -83,55 +83,57 @@ The version is a static field in `pyproject.toml`, managed with
8383
`main` always carries a `.dev` version (e.g. `1.29.1.dev0`) so development
8484
builds are marked as pre-releases and never collide with a published release.
8585

86-
### Increment Version
86+
`main` is a protected branch, so direct pushes are rejected. Releases go
87+
through a Release PR; only the tag is pushed directly (tags are not
88+
protected).
8789

88-
First prepare for next release by incrementing the version number
90+
### Open the Release PR
8991

90-
```bash
91-
# Drop the .dev suffix to cut the release (e.g. 1.29.1.dev0 -> 1.29.1)
92-
uv version --bump stable # use "--bump minor" if there are new features
93-
VERSION="$(uv version --short)"
94-
```
95-
96-
### Update CHANGELOG.md
97-
98-
Before releasing, replace the `Unreleased` heading in CHANGELOG.md with the
99-
version number and date. Update CHANGELOG.md before _EACH_ release, even beta
100-
releases.
92+
Increment the version and update CHANGELOG.md. The changelog must be updated
93+
before _EACH_ release, even beta releases.
10194

10295
```bash
96+
# Drop the .dev suffix to cut the release (e.g. 1.29.1.dev0 -> 1.29.1)
97+
VERSION="$(uv version --bump stable --dry-run --short)" # use "--bump minor" if there are new features
98+
git checkout -b "release-$VERSION" main
99+
uv version "$VERSION"
103100
sed -i "s/^## Unreleased/## [$VERSION] - $(date +%Y-%m-%d)/" docs/CHANGELOG.md
101+
git commit -am "Release $VERSION"
102+
git push -u origin "release-$VERSION"
103+
gh pr create --title "Release $VERSION" --body "Release $VERSION"
104104
```
105105

106-
### Tagging a Release
106+
### Merge the Release PR, then Tag main
107+
108+
After the PR is approved and merged, tag the merge commit on `main`.
109+
Do NOT tag your local release branch: squash-merging rewrites the SHA.
107110

108111
```bash
109-
git commit -am "Release $VERSION"
112+
git checkout main && git pull
113+
VERSION="$(uv version --short)" # sanity check: must be the release version
110114
git tag -a "$VERSION" -m "Release $VERSION"
111-
git push origin main "$VERSION"
115+
git push origin "$VERSION"
112116
```
113117

114-
On a tag push, the `distributions` job asserts the tag equals the
118+
On the tag push, the `distributions` job asserts the tag equals the
115119
`pyproject.toml` version, builds `rsconnect_python` and `rsconnect`, and
116120
publishes to [PyPI](https://pypi.org/project/rsconnect-python/#history) and the
117121
GitHub releases page.
118122

119123
### Re-arm development
120124

121-
After releasing, re-arm development on `main` by adding an
122-
`Unreleased` section to the CHANGELOG.md
125+
After releasing, re-arm development on `main` with a second PR that adds
126+
back the `Unreleased` section to CHANGELOG.md and moves to a development
127+
version
123128

124129
```bash
130+
VERSION="$(uv version --bump patch --bump dev --dry-run --short)" # e.g. 1.29.1 -> 1.29.2.dev1
131+
git checkout -b "rearm-$VERSION" main
125132
sed -i '0,/^## \[/s//## Unreleased\n\n&/' docs/CHANGELOG.md
126-
```
127-
128-
and then moving back to a development version
129-
130-
```bash
131-
uv version --bump patch --bump dev # e.g. 1.29.1 -> 1.29.2.dev1
132-
VERSION="$(uv version --short)"
133+
uv version "$VERSION"
133134
git commit -am "Begin $VERSION development"
134-
git push origin main
135+
git push -u origin "rearm-$VERSION"
136+
gh pr create --title "Begin $VERSION development" --body "Re-arm development after release"
135137
```
136138

137139
> **NOTE**: Pre-release versions must comply with [PEP 440](https://www.python.org/dev/peps/pep-0440/) so PyPI marks them as pre-releases. `uv version`'s `dev`/`alpha`/`beta`/`rc` bumps produce compliant strings.

0 commit comments

Comments
 (0)