-
Notifications
You must be signed in to change notification settings - Fork 688
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up the creation of the chart's GitHub release
Signed-off-by: Luke Shumaker <lukeshu@datawire.io>
- Loading branch information
Showing
7 changed files
with
99 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import fileinput | ||
import os.path | ||
import sys | ||
from os import getenv | ||
|
||
from lib import get_gh_repo, re_ga | ||
from lib.uiutil import run, run_txtcapture | ||
|
||
def main() -> int: | ||
chart_version = getenv("CHART_VERSION") | ||
if not (chart_version and chart_version.startswith("v") and re_ga.match(chart_version[1:])): | ||
sys.stderr.write(f'Usage: CHART_VERSION=v7.Y.Z {os.path.basename(sys.argv[0])}\n') | ||
return 2 | ||
|
||
content_gittag = "chart/{chart_version}" | ||
|
||
content_title = f"Emissary Ingress Chart {chart_version[1:]}" | ||
|
||
content_body = f""" | ||
## :tada: Emissary Ingress Chart {chart_version[1:]} :tada: | ||
Upgrade Emissary - https://www.getambassador.io/reference/upgrading#helm.html | ||
View changelog - https://github.com/emissary-ingress/emissary/blob/master/charts/emissary-ingress/CHANGELOG.md | ||
--- | ||
""" | ||
in_changelog = False | ||
for line in fileinput.FileInput("charts/emissary-ingress/CHANGELOG.md"): | ||
print(f"line={repr(line)}") | ||
if in_changelog: | ||
if line.startswith("## v"): | ||
break | ||
content_body += line | ||
if line == f"## {chart_version}\n": | ||
in_changelog = True | ||
content_body = content_body.strip() | ||
|
||
run([ | ||
"gh", "release", "create", | ||
"--repo="+get_gh_repo(), | ||
"--title="+content_title, | ||
"--notes="+content_body, | ||
content_gittag]) | ||
|
||
url = run_txtcapture([ | ||
"gh", "release", "view", | ||
"--json=url", | ||
"--jq=.url", | ||
"--repo="+get_gh_repo(), | ||
content_gittag]) | ||
print(f'::set-output name=url::{url}') | ||
|
||
|
||
if __name__ == '__main__': | ||
sys.exit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters