You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/06/04 15:46:14 UTC

[GitHub] [beam] TheNeuralBit commented on a change in pull request #11918: Add instructions to programmatically publish release to Github

TheNeuralBit commented on a change in pull request #11918:
URL: https://github.com/apache/beam/pull/11918#discussion_r435351070



##########
File path: website/www/site/content/en/contribute/release-guide.md
##########
@@ -1134,12 +1134,29 @@ 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 by calling the Github API (Make sure that the `GITHUB_TOKEN` variable is set):

Review comment:
       There's an earlier step in the release guide that has us [create a github token and write it to script.config](https://github.com/apache/beam/blob/59b87d87c3cedf89fda11f5cf31c066c852064d6/website/www/site/content/en/contribute/release-guide.md#run-automation-script-verify_release_buildsh). It would be nice if this were a script in release/src/main/scripts/ and could read the same token from script.config.

##########
File path: website/www/site/content/en/contribute/release-guide.md
##########
@@ -1134,12 +1134,29 @@ 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 by calling the Github API (Make sure that the `GITHUB_TOKEN` variable is set):
+
+    json_escape () {
+        printf '%s' "$1" | python -c 'import json,sys; print(json.dumps(sys.stdin.read()))'
+    }
+    
+    RELEASE_NOTES=$(sed -n '/^We are happy/,$p' website/www/site/content/en/blog/beam-${RELEASE}.md)
+    ESCAPED_NOTES=$(json_escape ${RELEASE_NOTES})
+    
+    RELEASE_JSON="$(cat <<-EOF
+    {
+      "tag_name": "${VERSION_TAG}",
+      "name": "Beam ${RELEASE} release",
+      "body": ${ESCAPED_NOTES}
+    }
+    EOF
+    )"
+    
+    curl https://api.github.com/repos/jphalip/beam/releases \

Review comment:
       This should be apache/beam :)

##########
File path: website/www/site/content/en/contribute/release-guide.md
##########
@@ -1134,12 +1134,29 @@ 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 by calling the Github API (Make sure that the `GITHUB_TOKEN` variable is set):
+
+    json_escape () {
+        printf '%s' "$1" | python -c 'import json,sys; print(json.dumps(sys.stdin.read()))'
+    }
+    
+    RELEASE_NOTES=$(sed -n '/^We are happy/,$p' website/www/site/content/en/blog/beam-${RELEASE}.md)

Review comment:
       It could be more robust to look for the license comment, I'm not quite sure how this sed command works but if you can make it retrieve everything after a multiline match something like this could work: `<!--.*Apache License, Version 2\.0.*-->`.
   
   I'd be fine leaving it as-is, but if we do there should be some kind of trap for when "We are happy" isn't matched so we don't unintentionally publish empty release notes.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org