Skip to content

Commit 0b44ebd

Browse files
committed
chore: update demo to the latest cookiecutter-robust-python
1 parent a8392ed commit 0b44ebd

File tree

5 files changed

+29
-11
lines changed

5 files changed

+29
-11
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": "897b90176c5ba388c031d48db3140b63cb3e2bc2",
2+
"_commit": "abd971947cb3c090dc6ed7141ba21c9a0e83fda1",
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": "897b90176c5ba388c031d48db3140b63cb3e2bc2",
3+
"commit": "abd971947cb3c090dc6ed7141ba21c9a0e83fda1",
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": "897b90176c5ba388c031d48db3140b63cb3e2bc2"
21+
"_commit": "abd971947cb3c090dc6ed7141ba21c9a0e83fda1"
2222
}
2323
},
2424
"directory": null

.github/workflows/prepare-release.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,12 @@ jobs:
3737
run: uvx nox -s bump-version ${{ steps.new_version.outputs.NEW_VERSION }}
3838

3939
- name: Get Release Notes
40-
id: changelog
41-
run: echo "CHANGELOG=$(python ./scripts/get-release-notes.py | base64)" >> $GITHUB_OUTPUT
40+
run: uvx nox -s get-release-notes ${{ github.workspace }}-CHANGELOG.md
4241

4342
- name: Create Release Draft
44-
uses: softprops/action-gh-release@v1
43+
uses: softprops/action-gh-release@v2
4544
with:
46-
body: ${{ steps.changelog.outputs.CHANGELOG }} | base64 --decode
45+
body_path: ${{ github.workspace }}-CHANGELOG.md
4746
draft: true
4847
tag_name: ${{ steps.new_version.outputs.NEW_VERSION }}
4948
env:

scripts/get-release-notes.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Script responsible for getting the release notes of the robust-python-demo package."""
2+
import argparse
23
from pathlib import Path
34

45
from util import get_latest_release_notes
@@ -9,7 +10,25 @@
910

1011
def main() -> None:
1112
"""Parses args and passes through to bump_version."""
12-
get_latest_release_notes()
13+
parser: argparse.ArgumentParser = get_parser()
14+
args: argparse.Namespace = parser.parse_args()
15+
release_notes: str = get_latest_release_notes()
16+
path: Path = RELEASE_NOTES_PATH if args.path is None else args.path
17+
path.write_text(release_notes)
18+
19+
20+
def get_parser() -> argparse.ArgumentParser:
21+
"""Creates the argument parser for prepare-release."""
22+
parser: argparse.ArgumentParser = argparse.ArgumentParser(
23+
prog="get-release-notes", usage="python ./scripts/get-release-notes.py"
24+
)
25+
parser.add_argument(
26+
"path",
27+
type=Path,
28+
metavar="PATH",
29+
help="Path the changelog will be written to.",
30+
)
31+
return parser
1332

1433

1534
if __name__ == "__main__":

scripts/util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def get_latest_tag() -> Optional[str]:
108108
return tag
109109

110110

111-
def get_latest_release_notes() -> None:
111+
def get_latest_release_notes() -> str:
112112
"""Gets the release notes.
113113
114114
Assumes the latest_tag hasn't been applied yet.
@@ -124,10 +124,10 @@ def get_latest_release_notes() -> None:
124124
result: subprocess.CompletedProcess = subprocess.run(
125125
["uvx", "--from", "commitizen", "cz", "changelog", rev_range, "--dry-run"],
126126
cwd=REPO_FOLDER,
127+
capture_output=True,
127128
check=True
128129
)
129-
if result.returncode != 0:
130-
raise ValueError("Unable to get release notes.")
130+
return result.stdout.decode("utf-8")
131131

132132

133133
def tag_release() -> None:

0 commit comments

Comments
 (0)