Skip to content

Commit 4a73736

Browse files
authored
docs: Modify changelog generator for adoc files (#217)
Modifies the changelog generator so that it generates an adoc formatted changelog which is placed in docs/release_notes/${VERSION}.adoc. Additionally, changes the markdown changelog which is used as the contents of the GitHub release to only have a reference to the download links for the binaries and a link to the official docs changelog. Last, modifies the existing `docs/ecctl-release-notes.asciidoc` file so the new changelog files are automatically added as part of `make changelog`. Signed-off-by: Marc Lopez <marc5.12@outlook.com>
1 parent b3f6d85 commit 4a73736

File tree

3 files changed

+73
-21
lines changed

3 files changed

+73
-21
lines changed

scripts/changelog.tpl.adoc

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[id="{p}-release-notes-vVERSION_REPLACE"]
2+
=== Elastic Cloud Control (ecctl) vVERSION_REPLACE
3+
++++
4+
<titleabbrev>vVERSION_REPLACE</titleabbrev>
5+
++++
6+
7+
<<{p}-release-notes-vVERSION_REPLACE-whats-new,What's new>> | <<{p}-release-notes-vVERSION_REPLACE-bug-fixes,Bug fixes>> | <<{p}-release-notes-vVERSION_REPLACE-breaking-changes,Breaking changes>> | <<{p}-release-notes-vVERSION_REPLACE-changelog,Changelog>>
8+
9+
Welcome to the vVERSION_REPLACE release of {n}. This version brings new features, some breaking changes, and bug fixes.
10+
11+
Elastic cloud control (ecctl) is Elastic’s CLI interface to manage the Elastic Cloud Enterprise platform (ECE) and Elasticsearch Service (ESS) and is now open for a public beta.
12+
13+
Download the release binaries:
14+
15+
[%hardbreaks]
16+
https://download.elastic.co/downloads/ecctl/VERSION_REPLACE/ecctl_VERSION_REPLACE_darwin_amd64.tar.gz[ecctl_VERSION_REPLACE_darwin_amd64.tar.gz]
17+
https://download.elastic.co/downloads/ecctl/VERSION_REPLACE/ecctl_VERSION_REPLACE_linux_32-bit.deb[ecctl_VERSION_REPLACE_linux_32-bit.deb]
18+
https://download.elastic.co/downloads/ecctl/VERSION_REPLACE/ecctl_VERSION_REPLACE_linux_32-bit.rpm[ecctl_VERSION_REPLACE_linux_32-bit.rpm]
19+
https://download.elastic.co/downloads/ecctl/VERSION_REPLACE/ecctl_VERSION_REPLACE_linux_386.tar.g[ecctl_VERSION_REPLACE_linux_386.tar.g]
20+
https://download.elastic.co/downloads/ecctl/VERSION_REPLACE/ecctl_VERSION_REPLACE_linux_64-bit.deb[ecctl_VERSION_REPLACE_linux_64-bit.deb]
21+
https://download.elastic.co/downloads/ecctl/VERSION_REPLACE/ecctl_VERSION_REPLACE_linux_64-bit.rpm[ecctl_VERSION_REPLACE_linux_64-bit.rpm]
22+
https://download.elastic.co/downloads/ecctl/VERSION_REPLACE/ecctl_VERSION_REPLACE_linux_amd64.tar.gz[ecctl_VERSION_REPLACE_linux_amd64.tar.gz]
23+
24+
[float]
25+
[id="{p}-release-notes-vVERSION_REPLACE-whats-new"]
26+
==== What's new
27+
28+
// TODO: FILL OR REMOVE
29+
30+
[float]
31+
[id="{p}-release-notes-vVERSION_REPLACE-bug-fixes"]
32+
==== Bug fixes
33+
34+
// TODO: FILL OR REMOVE
35+
36+
[float]
37+
[id="{p}-release-notes-vVERSION_REPLACE-breaking-changes"]
38+
==== Breaking changes
39+
40+
// TODO: FILL OR REMOVE
41+
42+
[float]
43+
[id="{p}-release-notes-vVERSION_REPLACE-changelog"]
44+
==== Changelog
45+
// The following section is autogenerated via git
46+
47+
[%hardbreaks]

scripts/changelog.tpl.md

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
# Changelog
22

3-
## Breaking changes
4-
<!-- Add the list of breaking changes, remove otherwise.-->
3+
Release binaries can be downloaded with the following links:
54

6-
## Notable changes
7-
<!-- Add the list of notable changes, remove otherwise.-->
5+
<https://download.elastic.co/downloads/ecctl/VERSION_REPLACE/ecctl_VERSION_REPLACE_darwin_amd64.tar.gz>
6+
<https://download.elastic.co/downloads/ecctl/VERSION_REPLACE/ecctl_VERSION_REPLACE_linux_32-bit.deb>
7+
<https://download.elastic.co/downloads/ecctl/VERSION_REPLACE/ecctl_VERSION_REPLACE_linux_32-bit.rpm>
8+
<https://download.elastic.co/downloads/ecctl/VERSION_REPLACE/ecctl_VERSION_REPLACE_linux_386.tar.gz>
9+
<https://download.elastic.co/downloads/ecctl/VERSION_REPLACE/ecctl_VERSION_REPLACE_linux_64-bit.deb>
10+
<https://download.elastic.co/downloads/ecctl/VERSION_REPLACE/ecctl_VERSION_REPLACE_linux_64-bit.rpm>
11+
<https://download.elastic.co/downloads/ecctl/VERSION_REPLACE/ecctl_VERSION_REPLACE_linux_amd64.tar.gz>
812

9-
### New Commands
10-
<!-- Add the list of new commands, remove otherwise.-->
13+
Checksums can be found [here](https://download.elastic.co/downloads/ecctl/VERSION_REPLACE/ecctl_VERSION_REPLACE_checksums.txt)
1114

12-
### Text output
13-
<!-- Add the list of text output changes, remove otherwise.-->
14-
15-
### Bug fixes
16-
<!-- Add the list of bug fixes, remove otherwise.-->
17-
18-
### Docs
19-
<!-- Add the list of doc changes, remove otherwise.-->
20-
21-
### Detailed changes
22-
<!-- AUTOGENERATED COMMIT LIST -->
15+
## Release notes
2316

17+
<https://www.elastic.co/guide/en/ecctl/current/ecctl-release-notes-vVERSION_REPLACE.html>

scripts/generate-changelog.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ fi
88
git fetch
99
PREV_TAG=$(git tag -l | tail -1)
1010
CHANGELOGFILE=notes/${VERSION}.md
11+
ADOC_CHANGELOG=docs/release_notes/${VERSION}.adoc
12+
ADOC_CHANGELOG_HISTORY=docs/ecctl-release-notes.asciidoc
1113

1214
if [[ -z ${PREV_TAG} ]]; then echo "-> Exiting changelog generation since there's no previous tag"; exit 0; fi
1315

@@ -16,16 +18,25 @@ read -p "=> Previous release was ${PREV_TAG}, is that correct? " -n 1 -r
1618

1719
if [[ ${REPLY} =~ ^[Yy]$ ]]; then
1820
echo ""
19-
cp scripts/changelog.tpl.md ${CHANGELOGFILE}
20-
git -c log.showSignature=false log --pretty="* %h %s" --no-decorate --no-color tags/${PREV_TAG}...master >> ${CHANGELOGFILE}
21+
sed "s/VERSION_REPLACE/$(echo ${VERSION}| sed 's/^v//')/g" scripts/changelog.tpl.md > ${CHANGELOGFILE}
22+
sed "s/VERSION_REPLACE/$(echo ${VERSION}| sed 's/^v//')/g" scripts/changelog.tpl.adoc > ${ADOC_CHANGELOG}
2123

24+
git -c log.showSignature=false log --pretty="https://github.com/elastic/ecctl/commit/%h[%h] %s" --no-decorate --no-color tags/${PREV_TAG}..master |\
25+
sed 's|#\(.*\))|https://github.com/elastic/ecctl/pull/\1\[\#\1\])|' >> ${ADOC_CHANGELOG}
26+
date "+%n_Release date: %B %d, %Y_" >> ${ADOC_CHANGELOG}
27+
28+
sed "5i\\
29+
|* <<{p}-release-notes-${VERSION}>>" ${ADOC_CHANGELOG_HISTORY} | tr '|' '\n' > ${ADOC_CHANGELOG_HISTORY}.copy
30+
echo "include::release_notes/${VERSION}.adoc[]" >> ${ADOC_CHANGELOG_HISTORY}.copy
31+
mv ${ADOC_CHANGELOG_HISTORY}.copy ${ADOC_CHANGELOG_HISTORY}
32+
2233
echo "=> Changelog generated."
2334
VISUAL="${VISUAL:-"${EDITOR:-vim}"}"
24-
read -p "==> The changelog will be opened with ${VISUAL}, press enter to continue or specify your desired editor: " -r
35+
read -p "==> The changelog (${ADOC_CHANGELOG}) will be opened with ${VISUAL}, press enter to continue or specify your desired editor: " -r
2536
if [[ ${REPLY} != "" ]]; then
2637
VISUAL=${REPLY}
2738
fi
28-
"${VISUAL}" "${CHANGELOGFILE}"
39+
"${VISUAL}" "${ADOC_CHANGELOG}"
2940
fi
3041

3142

0 commit comments

Comments
 (0)