You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by bh...@apache.org on 2020/06/04 20:21:44 UTC
[beam] branch master updated: [BEAM-10188] Add instructions to
programmatically publish release to Github (#11918)
This is an automated email from the ASF dual-hosted git repository.
bhulette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 4df16aa [BEAM-10188] Add instructions to programmatically publish release to Github (#11918)
4df16aa is described below
commit 4df16aa99a116243586e7f1ee3caaa23c0051e72
Author: Julien Phalip <jp...@gmail.com>
AuthorDate: Thu Jun 4 13:21:22 2020 -0700
[BEAM-10188] Add instructions to programmatically publish release to Github (#11918)
* Add instructions to programmatically publish release to Github
Fixes BEAM-10188
* Move release notes commands to separate script
* Add confirmation message to Github release notes script
* Load env vars in Github release notes script
* Small tweak to github release notes script
---
.../main/scripts/publish_github_release_notes.sh | 68 ++++++++++++++++++++++
.../site/content/en/contribute/release-guide.md | 9 +--
2 files changed, 71 insertions(+), 6 deletions(-)
diff --git a/release/src/main/scripts/publish_github_release_notes.sh b/release/src/main/scripts/publish_github_release_notes.sh
new file mode 100755
index 0000000..5c9c2d8
--- /dev/null
+++ b/release/src/main/scripts/publish_github_release_notes.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+set -e
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Load environment variables
+. script.config
+
+# Get this script's absolute path
+SCRIPT_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+
+# Extract release notes from the blog post
+POST_PATH=$(echo "${SCRIPT_PATH}/../../../../website/www/site/content/en/blog/beam-${RELEASE_VER}.md")
+RELEASE_NOTES=$(
+ cat ${POST_PATH} | # Read post's content
+ sed -n '/<!--/,$p' | # Remove post's metadata
+ sed -e :a -Ee 's/<!--.*-->.*//g;/<!--/N;//ba' | # Remove license
+ sed '/./,$!d' # Remove leading whitespace
+)
+
+# Escape notes' content to work with JSON
+ESCAPED_NOTES=$(printf '%s' "${RELEASE_NOTES}" | python -c 'import json,sys; print(json.dumps(sys.stdin.read()))')
+
+# Build JSON for the API request
+REQUEST_JSON="$(cat <<-EOF
+{
+ "tag_name": "v${RELEASE_VER}",
+ "name": "Beam ${RELEASE_VER} release",
+ "body": ${ESCAPED_NOTES}
+}
+EOF
+)"
+
+echo -e "Below is the request JSON about to be sent to the Github API:\n\n ${REQUEST_JSON}\n\n"
+
+read -r -p "Would you like to proceed and submit the request to the Github API? [Y/n] " input
+
+case $input in
+ [yY][eE][sS]|[yY])
+ ## Send request to Github API
+ curl https://api.github.com/repos/apache/beam/releases \
+ -X POST \
+ -H "Authorization: token ${GITHUB_TOKEN}" \
+ -H "Content-Type:application/json" \
+ -d "${REQUEST_JSON}"
+
+ echo -e "\n\nView the release on Github: https://github.com/apache/beam/releases/tag/v${RELEASE_VER}"
+ ;;
+
+ *)
+ echo "Aborting..."
+ exit 1
+ ;;
+esac
\ No newline at end of file
diff --git a/website/www/site/content/en/contribute/release-guide.md b/website/www/site/content/en/contribute/release-guide.md
index d04a967..0d81038 100644
--- a/website/www/site/content/en/contribute/release-guide.md
+++ b/website/www/site/content/en/contribute/release-guide.md
@@ -1134,12 +1134,9 @@ Create and push a new signed tag for the released version by copying the tag for
git tag -s "$VERSION_TAG" "$RC_TAG"
git push upstream "$VERSION_TAG"
-After the tag is uploaded, publish the release in the Github UI.
-1. Navigate to `https://github.com/apache/beam/releases/tag/$VERSION_TAG`.
-1. Click the "Edit tag" button.
-1. Give the release a title, such as `Beam 2.21.0`.
-1. For the release description, copy the current version's changes from `CHANGES.md`. (You may want to touch up the formatting a bit.)
-1. Click the "Publish release" button.
+After the tag is uploaded, publish the release notes to Github:
+
+ ./beam/release/src/main/scripts/publish_github_release_notes.sh
### Merge website pull request