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

Commit 0f4f9d7

Browse files
authored
Activate publishing of draft releases... (#5062)
* Activate publishing of draft releases... ... And fix the message sending (missing parameter). * publish_draft_release.sh now checks latest... ... release on github rather than just a tag
1 parent bad1280 commit 0f4f9d7

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.maintain/gitlab/lib.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ sanitised_git_logs(){
1414
sed 's/^/* /g'
1515
}
1616

17+
# Returns the last published release on github
18+
# repo: 'organization/repo'
19+
# Usage: last_github_release "$repo"
20+
last_github_release(){
21+
curl -H "Authorization: token $GITHUB_RELEASE_TOKEN" \
22+
-s "$api_base/$1/releases/latest" | jq '.tag_name'
23+
}
24+
1725
# Checks whether a tag on github has been verified
1826
# repo: 'organization/repo'
1927
# tagver: 'v1.2.3'

.maintain/gitlab/publish_draft_release.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ labels=(
1111
)
1212

1313
version="$CI_COMMIT_TAG"
14-
last_version=$(git tag -l | sort -V | grep -B 1 -x "$version" | head -n 1)
14+
15+
# Note that this is not the last *tagged* version, but the last *published* version
16+
last_version=$(last_github_release 'paritytech/substrate')
1517
echo "[+] Version: $version; Previous version: $last_version"
1618

1719
all_changes="$(sanitised_git_logs "$last_version" "$version")"
@@ -39,7 +41,7 @@ $labelled_changes"
3941

4042
echo "[+] Release text generated: "
4143
echo "$release_text"
42-
exit
44+
4345
echo "[+] Pushing release to github"
4446
# Create release on github
4547
release_name="Substrate $version"
@@ -79,6 +81,6 @@ formatted_msg_body=$(cat <<EOF
7981
Draft release created: $html_url
8082
EOF
8183
)
82-
send_message "$(structure_message "$msg_body" "$formatted_msg_body")" "$MATRIX_ACCESS_TOKEN"
84+
send_message "$(structure_message "$msg_body" "$formatted_msg_body")" "$MATRIX_ROOM_ID" "$MATRIX_ACCESS_TOKEN"
8385

8486
echo "[+] Done! Maybe the release worked..."

0 commit comments

Comments
 (0)