Releasing 2.0.0-alpha.4 (#5279)

* Version bump

* Split generate_changelog.sh into separate script

Can be run in the format `generate_changelog.sh $previous_version $version`.

* remove early exit from publish_draft_release.sh

* adding changelog

* ci: change last_github_release to also find pre-releases

Co-authored-by: Martin Pugh <pugh@s3kr.it>
This commit is contained in:
Benjamin Kampmann
2020-03-18 14:37:21 +01:00
committed by GitHub
parent d02868a0bf
commit 25e25a83b9
168 changed files with 1629 additions and 1530 deletions
+73
View File
@@ -0,0 +1,73 @@
#!/usr/bin/env bash
# shellcheck source=lib.sh
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/lib.sh"
version="$2"
last_version="$1"
all_changes="$(sanitised_git_logs "$last_version" "$version")"
runtime_changes=""
api_changes=""
client_changes=""
changes=""
while IFS= read -r line; do
pr_id=$(echo "$line" | sed -E 's/.*#([0-9]+)\)$/\1/')
# Skip if the PR has the silent label - this allows us to skip a few requests
if has_label 'paritytech/substrate' "$pr_id" 'B0-silent'; then
continue
fi
if has_label 'paritytech/substrate' "$pr_id" 'B1-runtimenoteworthy'; then
runtime_changes="$runtime_changes
$line"
fi
if has_label 'paritytech/substrate' "$pr_id" 'B1-clientnoteworthy'; then
client_changes="$client_changes
$line"
fi
if has_label 'paritytech/substrate' "$pr_id" 'B1-apinoteworthy' ; then
api_changes="$api_changes
$line"
continue
fi
done <<< "$all_changes"
# Make the substrate section if there are any substrate changes
if [ -n "$runtime_changes" ] ||
[ -n "$api_changes" ] ||
[ -n "$client_changes" ]; then
changes=$(cat << EOF
Substrate changes
-----------------
EOF
)
if [ -n "$runtime_changes" ]; then
changes="$changes
Runtime
-------
$runtime_changes"
fi
if [ -n "$client_changes" ]; then
changes="$changes
Client
------
$client_changes"
fi
if [ -n "$api_changes" ]; then
changes="$changes
API
---
$api_changes"
fi
release_text="$release_text
$changes"
fi
echo "$changes"
+14 -2
View File
@@ -15,11 +15,23 @@ sanitised_git_logs(){
}
# Returns the last published release on github
# Note: we can't just use /latest because that ignores prereleases
# repo: 'organization/repo'
# Usage: last_github_release "$repo"
last_github_release(){
curl -H "Authorization: token $GITHUB_RELEASE_TOKEN" \
-s "$api_base/$1/releases/latest" | jq '.tag_name'
i=0
# Iterate over releases until we find the last release that's not just a draft
while [ $i -lt 29 ]; do
out=$(curl -H "Authorization: token $GITHUB_RELEASE_TOKEN" -s "$api_base/$1/releases" | jq ".[$i]")
echo "$out"
# Ugh when echoing to jq, we need to translate newlines into spaces :/
if [ "$(echo "$out" | tr '\r\n' ' ' | jq '.draft')" = "false" ]; then
echo "$out" | tr '\r\n' ' ' | jq '.tag_name'
return
else
i=$((i + 1))
fi
done
}
# Checks whether a tag on github has been verified
@@ -3,44 +3,12 @@
# shellcheck source=lib.sh
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/lib.sh"
# Substrate labels for PRs we want to include in the release notes
labels=(
'B1-runtimenoteworthy'
'B1-clientnoteworthy'
'B1-apinoteworthy'
)
version="$CI_COMMIT_TAG"
# Note that this is not the last *tagged* version, but the last *published* version
last_version=$(last_github_release 'paritytech/substrate')
echo "[+] Version: $version; Previous version: $last_version"
all_changes="$(sanitised_git_logs "$last_version" "$version")"
labelled_changes=""
echo "[+] Iterating through $(wc -l <<< "$all_changes") changes to find labelled PRs"
while IFS= read -r line; do
pr_id=$(echo "$line" | sed -E 's/.*#([0-9]+)\)$/\1/')
# Skip if the PR has the silent label - this allows us to skip a few requests
if has_label 'paritytech/substrate' "$pr_id" 'B0-silent'; then
continue
fi
for label in "${labels[@]}"; do
if has_label 'paritytech/substrate' "$pr_id" "$label"; then
labelled_changes="$labelled_changes
$line"
fi
done
done <<< "$all_changes"
release_text="Substrate $version
-----------------
$labelled_changes"
echo "[+] Release text generated: "
echo "$release_text"
release_text="$(./generate_release_text.sh "$last_version" "$version")"
echo "[+] Pushing release to github"
# Create release on github