Skip to content

Commit 38e9324

Browse files
committed
Improve pipeline announcements
- Updated the discord announcement script - Added a script to get the beta changelog - Updated the way we generate release notes to match the type of release
1 parent a252ef9 commit 38e9324

File tree

4 files changed

+118
-6
lines changed

4 files changed

+118
-6
lines changed

.github/workflow_scripts/announce_discord.sh

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
WEBHOOK_URL=""
33
VERSION=""
44
BETA="FALSE"
5+
CANARY="FALSE"
6+
REPO=""
57
while [[ $# -gt 0 ]]; do
68
case $1 in
79
--webhook-url)
@@ -18,6 +20,15 @@ while [[ $# -gt 0 ]]; do
1820
BETA="TRUE"
1921
shift
2022
;;
23+
--canary)
24+
CANARY="TRUE"
25+
shift
26+
;;
27+
--repo)
28+
REPO=$2
29+
shift
30+
shift
31+
;;
2132
*)
2233
echo "Invalid argument: $1" >&2
2334
exit 1
@@ -38,7 +49,23 @@ fi
3849

3950
# Get the latest changelog content
4051
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
41-
CHANGELOG_CONTENT=$("$SCRIPT_DIR/get-latest-changelog.sh")
52+
if [ "$BETA" = "TRUE" ]; then
53+
CHANGELOG_CONTENT=$("$SCRIPT_DIR/get-latest-beta-changelog.sh" "--repo" "$REPO" "--version" "$VERSION")
54+
elif [ "$CANARY" = "TRUE" ]; then
55+
CHANGELOG_CONTENT=$("$SCRIPT_DIR/get-latest-beta-changelog.sh" "--repo" "$REPO" "--version" "$VERSION")
56+
else
57+
CHANGELOG_CONTENT=$("$SCRIPT_DIR/get-latest-changelog.sh")
58+
fi
59+
60+
if [ $? -ne 0 ]; then
61+
echo "Failed to get changelog content"
62+
exit 1
63+
fi
64+
65+
if [ -z "$CHANGELOG_CONTENT" ]; then
66+
echo "No changelog content found"
67+
exit 1
68+
fi
4269

4370
# Escape special characters for JSON
4471
CHANGELOG_CONTENT=$(echo "$CHANGELOG_CONTENT" | jq -Rs .)
@@ -51,9 +78,19 @@ if [ ${#CHANGELOG_CONTENT} -gt 4096 ]; then
5178
CHANGELOG_CONTENT+=$"\nFor the complete changelog, visit: https://github.com/Parallels/terraform-provider-parallels-desktop/releases/tag/v${VERSION}"
5279
fi
5380

54-
TITLE="📢 New Release v${VERSION}"
81+
if [[ ! $VERSION == v* ]]; then
82+
VERSION="v${VERSION}"
83+
fi
84+
85+
TITLE="📢 New Release ${VERSION}"
86+
COLOR="5763719"
5587
if [ "$BETA" = "TRUE" ]; then
56-
TITLE="🧪 New Beta Release v${VERSION}"
88+
TITLE="🧪 New Beta Release ${VERSION}"
89+
COLOR="3447003"
90+
fi
91+
if [ "$CANARY" = "TRUE" ]; then
92+
TITLE="🐤 New Canary Release ${VERSION}"
93+
COLOR="16776960"
5794
fi
5895

5996
# Create the JSON payload
@@ -63,7 +100,7 @@ JSON_PAYLOAD=$(
63100
"embeds": [{
64101
"title": "${TITLE}",
65102
"description": "${CHANGELOG_CONTENT}",
66-
"color": 3447003
103+
"color": ${COLOR}
67104
}]
68105
}
69106
EOF
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/bash
2+
3+
CHANGELOG_FILE="CHANGELOG.md"
4+
OUTPUT_FILE="release_notes.md"
5+
OUTPUT_TO_FILE="FALSE"
6+
REPO=""
7+
8+
while [[ $# -gt 0 ]]; do
9+
case $1 in
10+
-m)
11+
MODE=$2
12+
shift
13+
shift
14+
;;
15+
--version)
16+
VERSION=$2
17+
shift
18+
shift
19+
;;
20+
-v)
21+
VERSION=$2
22+
shift
23+
shift
24+
;;
25+
--CHANGELOG_FILE)
26+
CHANGELOG_FILE=$2
27+
shift
28+
shift
29+
;;
30+
--repo)
31+
REPO=$2
32+
shift
33+
shift
34+
;;
35+
--file)
36+
OUTPUT_FILE shift
37+
shift
38+
;;
39+
--output-to-file)
40+
OUTPUT_TO_FILE="TRUE"
41+
shift
42+
;;
43+
*)
44+
echo "Invalid argument: $1" >&2
45+
exit 1
46+
;;
47+
esac
48+
done
49+
50+
function generate_release_notes() {
51+
# Get the content for the highest version
52+
content=$(./.github/workflow_scripts/generate-changelog.sh --repo "$REPO" --mode RELEASE)
53+
54+
# Write the content to the output file
55+
if [ "$OUTPUT_TO_FILE" == "TRUE" ]; then
56+
echo -e "# Release Notes for v$VERSION\n\n$content" >$OUTPUT_FILE
57+
else
58+
echo -e "# Release Notes for v$VERSION\n\n$content"
59+
fi
60+
}
61+
62+
if [ -z "$REPO" ]; then
63+
echo "Error: --repo is not set" >&2
64+
exit 1
65+
fi
66+
67+
generate_release_notes

.github/workflows/create_release_pr.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,18 @@ jobs:
6161
git push --set-upstream origin release/$NEW_VERSION
6262
6363
echo "new_version=$NEW_VERSION" >> "$GITHUB_ENV"
64+
- name: Generate beta release notes
65+
if: ${{ vars.RELEASE_NAME == 'parallels-desktop-beta' }}
66+
run: |
67+
./.github/workflow_scripts/get-latest-beta-changelog.sh --repo ${{ github.repository }} --output-to-file --version "${EXT_VERSION}"
68+
cat release_notes.md
69+
- name: Generate release notes
70+
if: ${{ vars.RELEASE_NAME == 'parallels-desktop' }}
71+
run: |
72+
./.github/workflow_scripts/get-latest-changelog.sh --output-to-file
73+
cat release_notes.md
6474
- name: Create PR
6575
run: |
66-
./.github/workflow_scripts/generate-changelog.sh --mode RELEASE --repo ${{ github.repository }} --version ${{ env.new_version }} --output-to-file
6776
gh pr create \
6877
--title "Release version ${{ env.new_version }}" \
6978
--body-file release_notes.md \

.github/workflows/release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ jobs:
5151
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
5252
AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }}
5353
RELEASE_NAME: ${{ vars.RELEASE_NAME }}
54-
5554
verify-publications:
5655
needs: terraform-provider-release
5756
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)