Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #283 from luxas/relnotes
Browse files Browse the repository at this point in the history
Automatically generate the release notes
  • Loading branch information
luxas authored Aug 6, 2019
2 parents 5bf3b2f + 2047e9d commit ca63628
Show file tree
Hide file tree
Showing 7 changed files with 395 additions and 241 deletions.
27 changes: 27 additions & 0 deletions .grenrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
"dataSource": "prs",
"prefix": "",
"onlyMilestones": false,
"username": "weaveworks",
"repo": "ignite",
"groupBy": {
"New Features": ["kind/feature"],
"API Changes": ["kind/api-change"],
"Enhancements": ["kind/enhancement"],
"Bug Fixes": ["kind/bug"],
"Documentation": ["kind/documentation"],
"No category": ["closed"]
},
"changelogFilename": "docs/releases/next.md",
"ignore-labels": ["kind/cleanup"],
"template": {
commit: ({ message, url, author, name }) => `- [${message}](${url}) - ${author ? `@${author}` : name}`,
issue: "- {{labels}} {{name}} ([{{text}}]({{url}}), [@{{user_login}}]({{user_url}}))",
label: "",
noLabel: "closed",
group: "\n### {{heading}}\n",
changelogTitle: "",
release: "## {{release}}, {{date}}\n\n{{body}}",
releaseSeparator: "\n\n---\n\n"
}
}
508 changes: 296 additions & 212 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ release: push-all
ifneq ($(IS_DIRTY),0)
$(error "cannot release dirty tree")
endif
mkdir -p bin/releases/${GIT_VERSION}
cp -r bin/{amd64,arm64} bin/releases/${GIT_VERSION}
docker manifest create --amend $(IMAGE):$(IMAGE_TAG) $(shell echo $(GOARCH_LIST) | sed -e "s~[^ ]*~$(IMAGE):$(IMAGE_TAG)\-&~g")
@for arch in $(GOARCH_LIST); do docker manifest annotate --arch=$${arch} $(IMAGE):$(IMAGE_TAG) $(IMAGE):$(IMAGE_TAG)-$${arch}; done
docker manifest push --purge $(IMAGE):$(IMAGE_TAG)
Expand Down
10 changes: 3 additions & 7 deletions hack/minor-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ tag_release() {
fi

git checkout -B ${RELEASE_BRANCH}
git tag ${FULL_VERSION}
git tag -f ${FULL_VERSION}
}

push_artifacts() {
Expand All @@ -46,16 +46,12 @@ push_artifacts() {
cat <<- EOF
Done! Next, do this:
make -C images push-all
make image-push
git push --tags
git push origin ${RELEASE_BRANCH}
git push origin master
EOF
exit 1
fi
make -C images push-all
make image-push
git push --tags
git push origin ${RELEASE_BRANCH}
git push origin master
Expand All @@ -68,14 +64,14 @@ elif [[ $1 == "changelog" ]]; then
elif [[ $1 == "tag" ]]; then
tag_release
elif [[ $1 == "build" ]]; then
build_artifacts
build_push_release_artifacts
elif [[ $1 == "push" ]]; then
push_artifacts
elif [[ $1 == "all" ]]; then
make_tidy_autogen
write_changelog
tag_release
build_artifacts
build_push_release_artifacts
push_artifacts
else
echo "Usage: $0 [command]"
Expand Down
10 changes: 3 additions & 7 deletions hack/patch-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ tag_release() {
exit 1
fi

git tag ${FULL_VERSION}
git tag -f ${FULL_VERSION}
}

push_artifacts() {
Expand All @@ -54,15 +54,11 @@ push_artifacts() {
cat <<- EOF
Done! Next, do this:
make -C images push-all
make image-push
git push --tags
git push origin ${RELEASE_BRANCH}
EOF
exit 1
fi
make -C images push-all
make image-push
git push --tags
git push origin ${RELEASE_BRANCH}
}
Expand All @@ -74,14 +70,14 @@ elif [[ $1 == "changelog" ]]; then
elif [[ $1 == "tag" ]]; then
tag_release
elif [[ $1 == "build" ]]; then
build_artifacts
build_push_release_artifacts
elif [[ $1 == "push" ]]; then
push_artifacts
elif [[ $1 == "all" ]]; then
make_tidy_autogen
write_changelog
tag_release
build_artifacts
build_push_release_artifacts
push_artifacts
else
echo "Usage: $0 [command]"
Expand Down
70 changes: 55 additions & 15 deletions hack/release-common.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,66 @@
#!/bin/bash

docker build -t ignite-relnotes hack/relnotes

if [[ ! -f bin/gren_token ]]; then
echo "File bin/gren_token is needed; should contain a Github token with repo access"
exit 1
fi

run_gren() {
docker run -it \
-v $(pwd):/data \
-w /data \
-u $(id -u):$(id -g) \
-e GREN_GITHUB_TOKEN=$(cat bin/gren_token) \
ignite-relnotes \
/bin/bash -c "gren $@"
}

make_tidy_autogen() {
make tidy
make autogen
make autogen tidy graph
if [[ $(git status --short) != "" ]]; then
git add -A
git commit -m "Run make tidy and make autogen"
git commit -m "Ran 'make autogen tidy graph'"
fi
}

write_changelog() {
gen_changelog_md() {
file="CHANGELOG.md"
echo '<!-- Note: This file is autogenerated based on files in docs/releases. Run hack/release.sh to update -->' > ${file}
echo "" >> ${file}
echo "# Changelog" >> ${file}
echo "" >> ${file}
for release in $(find docs/releases/ -type f | grep -v rc | sort -Vr); do
cat ${release} >> ${file}
echo "" >> ${file}
done

# Generate docs/releases/next.md based of GH release notes
run_gren "changelog"
# Add the new release and existing ones to the changelog
cat docs/releases/next.md >> ${file}
# docs/releases/${FULL_VERSION}.md
# Remove the temporary file
rm docs/releases/next.md
}

write_changelog() {
# Generate the changelog draft
if [[ ! -f docs/releases/${FULL_VERSION}.md ]]; then
# Push the tag provisionally, we'll later update it
git tag ${FULL_VERSION}
git push upstream --tags

run_gren "changelog --generate"
mv docs/releases/next.md docs/releases/${FULL_VERSION}.md
fi

read -p "Please manually fixup the changelog file now. Continue? [y/N] " confirm
if [[ ! ${confirm} =~ ^[Yy]$ ]]; then
exit 1
fi

# Generate the CHANGELOG.md file
gen_changelog_md

# Proceed with making the commit
read -p "Are you sure you want to do a commit for the changelog? [y/N] " confirm
if [[ ! ${confirm} =~ ^[Yy]$ ]]; then
exit 1
Expand All @@ -28,10 +70,8 @@ write_changelog() {
git commit -m "Release ${FULL_VERSION}"
}

build_artifacts() {
make ignite
make ignite-spawn
mkdir -p bin/releases/${FULL_VERSION}
cp bin/ignite bin/releases/${FULL_VERSION}
make -C images build-all
}
build_push_release_artifacts() {
make release
# Do this at a later stage
#make -C images push-all
}
9 changes: 9 additions & 0 deletions hack/relnotes/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node

RUN apt-get update && apt-get install -y git

RUN npm install gulp -g
RUN git clone https://github.com/github-tools/github-release-notes
WORKDIR /github-release-notes
RUN npm install
RUN gulp build && ln -s /github-release-notes/bin/gren.js /usr/local/bin/gren

0 comments on commit ca63628

Please sign in to comment.