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

Commit

Permalink
Releasing 2.0.0-alpha.4 (#5279)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
gnunicorn and s3krit authored Mar 18, 2020
1 parent 8516190 commit 6a38fdc
Show file tree
Hide file tree
Showing 168 changed files with 1,629 additions and 1,530 deletions.
73 changes: 73 additions & 0 deletions .maintain/gitlab/generate_changelog.sh
Original file line number Diff line number Diff line change
@@ -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"
16 changes: 14 additions & 2 deletions .maintain/gitlab/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 1 addition & 33 deletions .maintain/gitlab/publish_draft_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 6a38fdc

Please sign in to comment.