Skip to content

Commit ff99459

Browse files
committed
Mark a pre-release as one, and keep the docs on the last release during it
1 parent f5c82d0 commit ff99459

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,14 @@ jobs:
7070
env:
7171
GH_TOKEN: ${{ github.token }}
7272
TAG: ${{ github.ref_name }}
73-
run: gh release create "${TAG}" dist/* --verify-tag --generate-notes --title "${TAG}"
73+
run: |
74+
flags=()
75+
# A pre-release (v0.5.1rc1) is marked as one, so it never becomes the latest
76+
# release, which is what the weekly patch run rebuilds and people install.
77+
if [[ ! "${TAG#v}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
78+
flags+=(--prerelease)
79+
fi
80+
gh release create "${TAG}" dist/* --verify-tag --generate-notes --title "${TAG}" "${flags[@]}"
7481
7582
# PyPI, through trusted publishing: PyPI trusts this workflow running in the pypi
7683
# environment, so no token is stored anywhere. It runs last because a version on PyPI

‎docs/development.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ tab; the full scan is kept with each run.
7777
3. `just release`: it checks the tree is clean and in step with `origin/main`, that the
7878
changelog has the version and the tag is new, then tags and pushes.
7979

80+
A pre-release, for trying a build where only PyPI (or a proxy of it, such as JFrog) can be
81+
reached, is the same with a version such as `0.5.1rc1`. PyPI takes it, but only asking for that
82+
version by name (or `--pre`) gets it; the GitHub release is marked a pre-release, and its
83+
images get only their exact tags, so `latest`, `slim` and the docs stay on the last release.
84+
8085
The release workflow runs CI again as a gate, builds, scans and pushes both images with
8186
attestations, and only then creates the GitHub release with the wheel, sdist and
8287
`SHA256SUMS`. A release never exists without its images.

‎tests/project/test_docs.py‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,16 @@ def test_install_lines_name_the_current_release():
127127
found
128128
for page in PAGES
129129
for found in re.findall(
130-
rf"install [^\n]*(?:@v|{re.escape(brand.DISTRIBUTION)}==)(\d+\.\d+\.\d+)",
130+
rf"install [^\n]*(?:@v|{re.escape(brand.DISTRIBUTION)}==)"
131+
r"(\d+\.\d+\.\d+(?:(?:a|b|rc)\d+|\.dev\d+)?)",
131132
page.read_text(),
132133
)
133134
}
134-
assert pinned == {version}
135+
if re.fullmatch(r"\d+\.\d+\.\d+", version):
136+
assert pinned == {version}
137+
else:
138+
# A pre-release (0.5.1rc1) is for trying out: the docs stay on the last release.
139+
assert len(pinned) == 1, pinned
135140

136141

137142
def test_the_readme_pypi_gets_links_to_files_that_exist():

0 commit comments

Comments
 (0)