Merge pull request #61 from keertk:patch-1

PiperOrigin-RevId: 507998343
Change-Id: I27ec96a4f459b2ffa37dbe6ce96d30265d6cd335
diff --git a/docs/release.md b/docs/release.md
index 3d61851..71520b3 100644
--- a/docs/release.md
+++ b/docs/release.md
@@ -12,18 +12,25 @@
 [Behind the java_tools release process](behind-the-release.md).
 
 1. Create a new tracking issue for the release in this repository and add the
-`release` label. See [#7](https://github.com/bazelbuild/java_tools/issues/7) as
+`release` label. See [#59](https://github.com/bazelbuild/java_tools/issues/59) as
 an example.
-2. Trigger a new build of the [`java_tools binaries pipeline`](https://buildkite.com/bazel-trusted/java-tools-binaries-java).
+2. Trigger a new build of the [`java_tools binaries pipeline`](https://buildkite.com/bazel-trusted/java-tools-binaries-java). Set the message field to "java_tools release [version] [rc]". See [example](https://buildkite.com/bazel-trusted/java-tools-binaries-java/builds/189).
 3. Identify and set the following environment variables:
 
   * `COMMIT_HASH` the commit hash where the pipeline was run (see below)
-  * `NEW_VERSION` the new version number you’re trying to release (e.g. `3.1`)
+  * `NEW_VERSION` the new version number you’re trying to release (e.g. `11.09`)
   * `RC` the number of the current release candidate
 
-4. Create a new release candidate by running the command below from the bazel repo:
+     For example:
+     ```bash
+     export COMMIT_HASH=7bd0ab63a8441c3f3d7f495d09ed2bed38762874
+     export NEW_VERSION=11.09
+     export RC=1
+     ```
 
-    ```
+4. Create a new release candidate by running the command below from the [bazel](https://github.com/bazelbuild/bazel) repo:
+
+    ```bash
     src/create_java_tools_release.sh \
     --commit_hash $COMMIT_HASH \
     --java_tools_version $NEW_VERSION \
@@ -32,27 +39,119 @@
 
     The script will output the sha256sum of the rc artifacts for linux, darwin
     and windows.
+    
+    Sample output:
+    ```bash
+    $ src/create_java_tools_release.sh --commit_hash 7bd0ab63a8441c3f3d7f495d09ed2bed38762874 --java_tools_version 11.9 --rc 1 --release false
 
-5. Create a new bazel Pull Request that updates the `java_tools` archives (file 
-[distdir_deps.bzl](https://github.com/bazelbuild/bazel/blob/master/distdir_deps.bzl))
-with the new release candidates.
-The PR triggers the CI presubmit.
+      release_candidates/java/v11.9/java_tools_linux-v11.9-rc1.zip 512582cac5b7ea7974a77b0da4581b21f546c9478f206eedf54687eeac035989
+      release_candidates/java/v11.9/java_tools_windows-v11.9-rc1.zip 677ab910046205020fd715489147c2bcfad8a35d9f5d94fdc998d217545bd87a
+      release_candidates/java/v11.9/java_tools_darwin-v11.9-rc1.zip b9e962c6a836ba1d7573f2473fab3a897c6370d4c2724bde4017b40932ff4fe4
+      release_candidates/java/v11.9/java_tools-v11.9-rc1.zip 5cd59ea6bf938a1efc1e11ea562d37b39c82f76781211b7cd941a2346ea8484d
+    ```
 
+5. Create a new bazel Pull Request that updates the `java_tools` archives (file [distdir_deps.bzl](https://github.com/bazelbuild/bazel/blob/master/distdir_deps.bzl)) with the new release candidates. The PR triggers the CI presubmit.  
 
-6. Trigger a new build on Downstream https://buildkite.com/bazel/bazel-at-head-plus-downstream.
-   Using `pull/PRNUMBER/head` for the branch.
+  * Edit [distdir_deps.bzl](https://github.com/bazelbuild/bazel/blob/master/distdir_deps.bzl) by updating the `archive`, `sha256`, and `urls` fields for `remote_java_tools` with the correct version, rc, sha256sum, and url (see output from step 4)
+  
+     Example:
+     ```starlark
+     "archive": "java_tools-v11.9-rc1.zip",
+     "sha256": "5cd59ea6bf938a1efc1e11ea562d37b39c82f76781211b7cd941a2346ea8484d",
+     "urls": [
+         "https://mirror.bazel.build/bazel_java_tools/release_candidates/java/v11.9/java_tools-v11.9-rc1.zip",
+     ],
+     ```
+     
+  * Repeat for `remote_java_tools_linux`, `remote_java_tools_windows`, and `remote_java_tools_darwin`
+  * See [#16865](https://github.com/bazelbuild/bazel/pull/16865) for reference ([this](https://github.com/bazelbuild/bazel/pull/16865/commits/5e1a96221828b91eef634a2087e63d056fb2b146) commit)
+
+6. Trigger a new build on Downstream https://buildkite.com/bazel/bazel-at-head-plus-downstream. Set the message field to "java_tools release [version] [rc]", leave the commit field as "HEAD", and use `pull/[PRNUMBER]/head` for the branch. See [example](https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/2818). 
 
     1. If the CI finishes successfully:
-        - create the release artifacts from the
-        release candidate:
-        ```
-        src/create_java_tools_release.sh \
-        --java_tools_version $NEW_VERSION \
-        --rc $RC --release true
-        ```
-        - update the urls of the `http_archive`s in the upgrade PR and send it for
-        review.
+        - create the release artifacts from the release candidate:
+          ```bash
+          src/create_java_tools_release.sh \
+          --java_tools_version $NEW_VERSION \
+          --rc $RC --release true
+          ```
+          The script will output the sha256sum of the rc artifacts for linux, darwin and windows.
+
+          Sample output:
+          ```bash
+          $ src/create_java_tools_release.sh --commit_hash 7bd0ab63a8441c3f3d7f495d09ed2bed38762874 --java_tools_version 11.9 --rc 1 --release true
+
+            releases/java/v11.9/java_tools_linux-v11.9.zip 512582cac5b7ea7974a77b0da4581b21f546c9478f206eedf54687eeac035989
+            releases/java/v11.9/java_tools_windows-v11.9.zip 677ab910046205020fd715489147c2bcfad8a35d9f5d94fdc998d217545bd87a
+            releases/java/v11.9/java_tools_darwin-v11.9.zip b9e962c6a836ba1d7573f2473fab3a897c6370d4c2724bde4017b40932ff4fe4
+            releases/java/v11.9/java_tools-v11.9.zip 5cd59ea6bf938a1efc1e11ea562d37b39c82f76781211b7cd941a2346ea8484d
+          ```
+
+        - Return to your PR and update the update the `archive`, `sha256`, and `urls` fields again (see step 5 above for reference). See [#16865](https://github.com/bazelbuild/bazel/pull/16865) ([this](https://github.com/bazelbuild/bazel/pull/16865/commits/863b71d654dfefa52f81ed986a83766e3aade2d4) commit).
+
+           Example:
+           ```starlark
+           "archive": "java_tools-v11.9.zip",
+           "sha256": "5cd59ea6bf938a1efc1e11ea562d37b39c82f76781211b7cd941a2346ea8484d",
+           "urls": [
+              "https://mirror.bazel.build/bazel_java_tools/releases/java/v11.9/java_tools-v11.9.zip",
+              "https://github.com/bazelbuild/java_tools/releases/download/java_v11.9/java_tools-v11.9.zip",
+           ],
+           ```
+        - Update the release in the java_tools [releases page](https://github.com/bazelbuild/java_tools/releases)
+            -   Create on "Draft a new release"
+                -   Set tag to java_v[version number], e.g. java_v11.09
+                -   Set target to master
+                -   Add the name, sha256, and urls to the description
+
+                Example:
+                ```
+                To use this java_tools release, add to your WORKSPACE file the definitions:
+
+                http_archive(
+                    name = "remote_java_tools",
+                    sha256 = "5cd59ea6bf938a1efc1e11ea562d37b39c82f76781211b7cd941a2346ea8484d",
+                    urls = [
+                            "https://mirror.bazel.build/bazel_java_tools/releases/java/v11.9/java_tools-v11.9.zip",
+                            "https://github.com/bazelbuild/java_tools/releases/download/java_v11.9/java_tools-v11.9.zip",
+                    ],
+                )
+
+                http_archive(
+                    name = "remote_java_tools_linux",
+                    sha256 = "512582cac5b7ea7974a77b0da4581b21f546c9478f206eedf54687eeac035989",
+                    urls = [
+                            "https://mirror.bazel.build/bazel_java_tools/releases/java/v11.9/java_tools_linux-v11.9.zip",
+                            "https://github.com/bazelbuild/java_tools/releases/download/java_v11.9/java_tools_linux-v11.9.zip",
+                    ],
+                )
+
+                http_archive(
+                    name = "remote_java_tools_windows",
+                    sha256 = "677ab910046205020fd715489147c2bcfad8a35d9f5d94fdc998d217545bd87a",
+                    urls = [
+                            "https://mirror.bazel.build/bazel_java_tools/releases/java/v11.9/java_tools_windows-v11.9.zip",
+                            "https://github.com/bazelbuild/java_tools/releases/download/java_v11.9/java_tools_windows-v11.9.zip",    
+                    ],
+                )
+
+                http_archive(
+                    name = "remote_java_tools_darwin",
+                    sha256 = "b9e962c6a836ba1d7573f2473fab3a897c6370d4c2724bde4017b40932ff4fe4",
+                    urls = [
+                            "https://mirror.bazel.build/bazel_java_tools/releases/java/v11.9/java_tools_darwin-v11.9.zip",
+                            "https://github.com/bazelbuild/java_tools/releases/download/java_v11.9/java_tools_darwin-v11.9.zip",
+                    ],
+                )
+                ```
+                
+                -   Download the 4 .zip files from mirror.bazel.build/bazel_java_tools/releases and attach them to the release
+                -   Set as the latest release
+                -   Refer to [this example](https://github.com/bazelbuild/java_tools/releases/tag/java_v11.9)
+
+        - Update package_version, see [example](https://github.com/bazelbuild/bazel/pull/17203/commits/308ed35f45e82163a84313ef67610a32198f6555)
+        - After making sure presubmits pass, send the PR for review and assign `@comius` and `@hvadehra`
     2. If the CI finishes unsuccessfully find the reasons why the CI is failing
-    and file bugs. After the bugs are fixed start all over again creating the
+    and file bugs. After the bugs are fixed start all over again from step 2 and create the
     next release candidate. This case is highly unlikely because bazel already
     tests the `java_tools` built at head.