Skip to content

Commit cab740b

Browse files
committed
chore: update demo to the latest cookiecutter-robust-python
1 parent e77b370 commit cab740b

File tree

7 files changed

+65
-30
lines changed

7 files changed

+65
-30
lines changed

.cookiecutter.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"_commit": "34a57b81ff4263362669776636b30a8d051687a3",
2+
"_commit": "9490ead9e72f2e78d421b5d791e64e312af7905d",
33
"_template": "C:\\Users\\56kyl\\source\\repos\\cookiecutter-robust-python",
44
"add_rust_extension": false,
55
"author": "Kyle Oliver",

.cruft.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"template": "C:\\Users\\56kyl\\source\\repos\\cookiecutter-robust-python",
3-
"commit": "34a57b81ff4263362669776636b30a8d051687a3",
3+
"commit": "9490ead9e72f2e78d421b5d791e64e312af7905d",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {
@@ -18,7 +18,7 @@
1818
"license": "MIT",
1919
"development_status": "Development Status :: 1 - Planning",
2020
"_template": "C:\\Users\\56kyl\\source\\repos\\cookiecutter-robust-python",
21-
"_commit": "34a57b81ff4263362669776636b30a8d051687a3"
21+
"_commit": "9490ead9e72f2e78d421b5d791e64e312af7905d"
2222
}
2323
},
2424
"directory": null

.github/workflows/bump-version.yml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ on:
77

88
jobs:
99
bump-version:
10+
name: "Bump version and create changelog with commitizen"
1011
if: "!startsWith(github.event.head_commit.message, 'bump:')"
1112
runs-on: ubuntu-latest
12-
name: "Bump version and create changelog with commitizen"
1313
steps:
1414
- name: Check out
1515
uses: actions/checkout@v4
@@ -20,3 +20,38 @@ jobs:
2020
uses: commitizen-tools/commitizen-action@master
2121
with:
2222
github_token: ${{ secrets.GITHUB_TOKEN }}
23+
changelog_increment_filename: body.md
24+
25+
generate-release-notes:
26+
name: "Generate Release Notes"
27+
if: "startsWith(github.event.head_commit.message, 'bump:')"
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
33+
- name: Set up uv
34+
uses: astral-sh/setup-uv@v6
35+
36+
- name: Set up Python
37+
uses: actions/setup-python@v5
38+
with:
39+
python-version-file: ".github/workflows/.python-version"
40+
41+
- name: Get Release Notes
42+
run: uvx -s
43+
44+
generate-release-draft:
45+
name: "Generate Release Draft"
46+
if: always()
47+
needs: [bump-version, generate-release-notes]
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Release
51+
uses: softprops/action-gh-release@v1
52+
with:
53+
body_path: "body.md"
54+
tag_name: ${{ env.REVISION }}
55+
draft: "true"
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-github.yml

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

noxfile.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def build_container(session: Session) -> None:
193193
session.log(f"Container image {project_image_name}:latest built locally.")
194194

195195

196-
@nox.session(python=None, name="seutp-release", tags=[RELEASE])
196+
@nox.session(python=None, name="setup-release", tags=[RELEASE])
197197
def setup_release(session: Session) -> None:
198198
"""Prepares a release by creating a release branch and bumping the version.
199199
@@ -204,6 +204,13 @@ def setup_release(session: Session) -> None:
204204
session.run("python", SCRIPTS_FOLDER / "setup-release.py", external=True)
205205

206206

207+
@nox.session(python=None, name="get-release-notes", tags=[RELEASE])
208+
def get_release_notes(session: Session) -> None:
209+
"""Gets the latest release notes if between bumping the version and tagging the release."""
210+
session.log("Getting release notes...")
211+
session.run("python", SCRIPTS_FOLDER / "get-release-notes.py", external=True)
212+
213+
207214
@nox.session(python=None, tags=[RELEASE])
208215
def release(session: Session) -> None:
209216
"""Run the release process using Commitizen.

scripts/get-release-notes.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""Script responsible for getting the release notes of the robust-python-demo package."""
2+
from pathlib import Path
3+
4+
from util import get_latest_release_notes
5+
6+
7+
RELEASE_NOTES_PATH: Path = Path("body.md")
8+
9+
10+
def main() -> None:
11+
"""Parses args and passes through to bump_version."""
12+
release_notes: str = get_latest_release_notes()
13+
RELEASE_NOTES_PATH.write_text(release_notes)
14+
15+
16+
if __name__ == "__main__":
17+
main()

scripts/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def get_latest_tag() -> Optional[str]:
113113
return tag
114114

115115

116-
def get_latest_release_notes() -> None:
116+
def get_latest_release_notes() -> str:
117117
"""Gets the release notes.
118118
119119
Assumes the latest_tag hasn't been applied yet.

0 commit comments

Comments
 (0)