Skip to content

Commit a746f8b

Browse files
author
Alix Cook
committed
automate chart release
1 parent a01c517 commit a746f8b

File tree

5 files changed

+63
-0
lines changed

5 files changed

+63
-0
lines changed

.circleci/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ jobs:
1212
- job-chart
1313
"aes-chart-publish":
1414
executor: aes-linux
15+
environment:
16+
PUBLISH_GIT_RELEASE: "true"
1517
steps:
1618
- job-chart-publish
1719
"aes-manifest-publish":

.circleci/config.yml.d/amb_aes.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313

1414
"aes-chart-publish":
1515
executor: aes-linux
16+
environment:
17+
PUBLISH_GIT_RELEASE: "true"
1618
steps:
1719
- job-chart-publish
1820

charts/edge-stack/RELEASE.tpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## :tada: Ambassador Edge Stack Chart $CHART_VERSION :tada:
2+
3+
Upgrade Edge Stack - https://www.getambassador.io/reference/upgrading#helm.html
4+
View changelog - https://github.com/emissary-ingress/edge-stack/blob/$CHART_VERSION/charts/edge-stack/CHANGELOG.md
5+
6+
---
7+
8+

charts/edge-stack/RELEASE_TITLE.tpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ambassador Edge Stack Chart $CHART_VERSION

charts/scripts/push_chart.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,53 @@ done
7575
info "Cleaning up..."
7676
echo
7777
rm ${chart_dir}/tmp.yaml "$CHART_PACKAGE"
78+
79+
if [[ $thisversion =~ ^[0-9]+\.[0-9]+\.[0-9]+(-ea)?$ ]] && [[ -n "${PUBLISH_GIT_RELEASE}" ]]; then
80+
if [[ -z "${CIRCLE_SHA1}" ]] ; then
81+
echo "CIRCLE_SHA1 not set"
82+
exit 1
83+
fi
84+
if [[ -z "${GH_RELEASE_TOKEN}" ]] ; then
85+
echo "GH_RELEASE_TOKEN not set"
86+
exit 1
87+
fi
88+
tag="chart-v${thisversion}"
89+
export CHART_VERSION=${thisversion}
90+
title=`envsubst < ${chart_dir}/RELEASE_TITLE.tpl`
91+
repo_full_name="datawire/edge-stack"
92+
token="${GH_RELEASE_TOKEN}"
93+
description=`envsubst < ${chart_dir}/RELEASE.tpl | awk '{printf "%s\\\n", $0}'`
94+
in_changelog=false
95+
while IFS= read -r line ; do
96+
if ${in_changelog} ; then
97+
if [[ "${line}" =~ "## v" ]] ; then
98+
break
99+
fi
100+
if [[ -n "${line}" ]] ; then
101+
description="${description}\\n${line}"
102+
fi
103+
fi
104+
if [[ "${line}" =~ "## v${chart_version}" ]] ; then
105+
in_changelog=true
106+
fi
107+
108+
done < ${chart_dir}/CHANGELOG.md
109+
110+
generate_post_data()
111+
{
112+
cat <<EOF
113+
{
114+
"tag_name": "$tag",
115+
"name": "$title",
116+
"body": "${description}",
117+
"draft": false,
118+
"prerelease": false,
119+
"target_commitish": "${CIRCLE_SHA1}"
120+
}
121+
EOF
122+
}
123+
curl --fail -H "Authorization: token ${token}" --data "$(generate_post_data)" "https://api.github.com/repos/$repo_full_name/releases"
124+
fi
125+
126+
exit 0
127+

0 commit comments

Comments
 (0)