Skip to content

Commit abd9719

Browse files
committed
feat: replace body usage with body_path and make use of github.workspace
1 parent 471482a commit abd9719

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

{{cookiecutter.project_name}}/.github/workflows/prepare-release.yml

Lines changed: 2 additions & 3 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
4443
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:

{{cookiecutter.project_name}}/scripts/get-release-notes.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Script responsible for getting the release notes of the {{cookiecutter.project_name}} package."""
2+
import argparse
23
from pathlib import Path
34

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

1011
def main() -> None:
1112
"""Parses args and passes through to bump_version."""
13+
parser: argparse.ArgumentParser = get_parser()
14+
args: argparse.Namespace = parser.parse_args()
1215
release_notes: str = get_latest_release_notes()
13-
RELEASE_NOTES_PATH.write_text(release_notes)
14-
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
1532

1633

1734
if __name__ == "__main__":

0 commit comments

Comments
 (0)