9
9
required : true
10
10
type : string
11
11
pre_release_version :
12
- description : " Pre-Release version, e.g. 'beta-1'"
12
+ description : " (Optional) Pre-Release version, e.g. 'beta-1'. Used mainly to support consensus release on betanet. "
13
13
required : false
14
14
type : string
15
15
43
43
fi
44
44
45
45
- name : Checkout
46
- uses : actions/checkout@v3
46
+ uses : actions/checkout@v3.5.3
47
47
with :
48
48
fetch-depth : 0
49
49
@@ -78,60 +78,33 @@ jobs:
78
78
fi
79
79
80
80
- name : Build Changelog
81
-
82
81
id : build-changelog
83
82
env :
84
83
PREVIOUS_VERSION : ${{ steps.get-release.outputs.latest-tag }}
85
- with :
86
- fromTag : ${{ env.PREVIOUS_VERSION }}
87
- toTag : ${{ env.RELEASE_BRANCH }}
88
- failOnError : true
89
- configurationJson : |
90
- {
91
- "categories": [
92
- {
93
- "title": "## New Features",
94
- "labels": [
95
- "New Feature"
96
- ]
97
- },
98
- {
99
- "title": "## Enhancements",
100
- "labels": [
101
- "Enhancement"
102
- ]
103
- },
104
- {
105
- "title": "## Bug Fixes",
106
- "labels": [
107
- "Bug-Fix"
108
- ]
109
- },
110
- {
111
- "title": "## Not Yet Enabled",
112
- "labels": [
113
- "Not-Yet-Enabled"
114
- ]
115
- }
116
- ],
117
- "ignore_labels": [
118
- "Skip-Release-Notes"
119
- ],
120
- "sort": {
121
- "order": "ASC",
122
- "on_property": "mergedAt"
123
- },
124
- "template": "#{{CHANGELOG}}",
125
- "pr_template": "- #{{TITLE}} by @#{{AUTHOR}} in ##{{NUMBER}}"
126
- }
84
+ run : |
85
+ CHANGELOG=$(curl -L \
86
+ -X POST \
87
+ -H "Accept: application/vnd.github+json" \
88
+ -H "Authorization: Bearer ${{ github.token }}"\
89
+ -H "X-GitHub-Api-Version: 2022-11-28" \
90
+ https://api.github.com/repos/${{ github.repository }}/releases/generate-notes \
91
+ -d '{"tag_name":"${{ env.RELEASE_VERSION }}","target_commitish":"${{ env.RELEASE_BRANCH }}","previous_tag_name":"${{ env.PREVIOUS_VERSION }}","configuration_file_path":".github/release.yml"}' \
92
+ | jq -r '.body')
93
+
94
+ # The EOF steps are used to save multiline string in github:
95
+ # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-of-a-multiline-string
96
+ EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
97
+ echo "changelog<<$EOF" >> $GITHUB_OUTPUT
98
+ echo -e "${CHANGELOG}" >> $GITHUB_OUTPUT
99
+ echo "$EOF" >> $GITHUB_OUTPUT
127
100
128
101
- name : Update Changelog
129
102
if : ${{ env.PRE_RELEASE_VERSION == '' }}
130
103
env :
131
104
CHANGELOG_CONTENT : ${{ steps.build-changelog.outputs.changelog }}
132
105
PREVIOUS_VERSION : ${{ steps.get-release.outputs.latest-tag }}
133
106
run : |
134
- echo -e "# ${RELEASE_VERSION}\n\n${CHANGELOG_CONTENT}**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREVIOUS_VERSION}...${RELEASE_VERSION} \n" | cat - CHANGELOG.md > temp && mv temp CHANGELOG.md
107
+ echo -e "# ${RELEASE_VERSION}\n\n${CHANGELOG_CONTENT}\n" | cat - CHANGELOG.md > temp && mv temp CHANGELOG.md
135
108
136
109
- name : Update Version References in Source
137
110
env :
@@ -153,15 +126,12 @@ jobs:
153
126
GH_TOKEN : ${{ github.token }}
154
127
RELEASE_TAG : ${{ steps.set-release.outputs.release-tag }}
155
128
run : |
156
- echo -e "# What's Changed\n\n${CHANGELOG_CONTENT}**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREVIOUS_VERSION}...${RELEASE_TAG}" > tmp_msg_body.txt
157
- export msg_body=$(cat tmp_msg_body.txt)
158
- rm tmp_msg_body.txt
159
129
# Note: There's an issue adding teams as reviewers, see https://github.com/cli/cli/issues/6395
160
130
PULL_REQUEST_URL=$(gh pr create --base "master" \
161
131
--title "FOR REVIEW ONLY: ${{ github.event.repository.name }} $RELEASE_TAG" \
162
132
--label "Skip-Release-Notes" \
163
133
--label "Team Hyper Flow" \
164
- --body "$msg_body " | tail -n 1)
134
+ --body "${CHANGELOG_CONTENT} " | tail -n 1)
165
135
if [[ $PULL_REQUEST_URL =~ ^https://github.com/${{ github.repository }}/pull/[0-9]+$ ]]; then
166
136
PULL_REQUEST_NUM=$(echo $PULL_REQUEST_URL | sed 's:.*/::')
167
137
echo "pull-request-master=$PULL_REQUEST_URL" >> $GITHUB_ENV
0 commit comments