Skip to content

Commit

Permalink
Generate next release notes when on master for nightly builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Megan Wilhite committed Apr 5, 2023
1 parent 2e7a244 commit 1e5c703
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,13 @@ jobs:
shell: bash
if: ${{ startsWith(github.event.ref, 'refs/tags') == false }}
run: |
tools changelog update-release-notes --draft
tools changelog update-release-notes
if [ "${{ contains(fromJSON('["master"]'), github.ref_name) }}" == "true" ]; then
tools changelog update-release-notes --draft --next-release
tools changelog update-release-notes --next-release
else
tools changelog update-release-notes --draft
tools changelog update-release-notes
fi
- name: Generate MAN Pages
shell: bash
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/templates/ci.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,18 @@ on:
shell: bash
if: ${{ startsWith(github.event.ref, 'refs/tags') == false }}
run: |
<%- if gh_environment == 'nightly' %>
if [ "${{ contains(fromJSON('["master"]'), github.ref_name) }}" == "true" ]; then
tools changelog update-release-notes --draft <%- if prepare_actual_release %> --release <%- endif %> --next-release
tools changelog update-release-notes <%- if prepare_actual_release %> --release <%- endif %> --next-release
else
tools changelog update-release-notes --draft <%- if prepare_actual_release %> --release <%- endif %>
tools changelog update-release-notes <%- if prepare_actual_release %> --release <%- endif %>
fi
<%- else %>
tools changelog update-release-notes --draft <%- if prepare_actual_release %> --release <%- endif %>
tools changelog update-release-notes <%- if prepare_actual_release %> --release <%- endif %>
<%- endif %>

- name: Generate MAN Pages
shell: bash
Expand Down
18 changes: 16 additions & 2 deletions tools/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from jinja2 import Environment, FileSystemLoader
from ptscripts import Context, command_group

import salt.version
from tools.utils import REPO_ROOT, Version

CHANGELOG_LIKE_RE = re.compile(r"([\d]+)\.([a-z]+)$")
Expand Down Expand Up @@ -299,6 +300,9 @@ def update_deb(ctx: Context, salt_version: Version, draft: bool = False):
"template_only": {
"help": "Only generate a template file.",
},
"next_release": {
"help": "Generate release notes for the next upcoming release.",
},
},
)
def update_release_notes(
Expand All @@ -307,6 +311,7 @@ def update_release_notes(
draft: bool = False,
release: bool = False,
template_only: bool = False,
next_release: bool = False,
):
if salt_version is None:
salt_version = _get_salt_version(ctx)
Expand All @@ -325,6 +330,15 @@ def update_release_notes(
release_notes_path = pathlib.Path("doc/topics/releases") / "{}.md".format(
version
)
if next_release and not release:
version = ".".join(
str(part)
for part in salt.version.SaltStackVersion(*version).next_release().info
)
release_notes_path = pathlib.Path("doc/topics/releases") / "{}.md".format(
version
)

template_release_path = (
release_notes_path.parent / "templates" / f"{version}.md.template"
)
Expand All @@ -337,12 +351,12 @@ def update_release_notes(
{{{{ warning }}}}
<!--
Add relase specific details below
Add release specific details below
-->
<!--
Do not edit the changelog below.
This is auto generated
This is auto generated.
-->
## Changelog
{{{{ changelog }}}}
Expand Down

0 comments on commit 1e5c703

Please sign in to comment.