Repository: etcd-io/etcd (language: go)

Issue:
Release script doesn't work for v3.6.0 (main branch) releases
### Bug report criteria

- [X] This bug report is not security related, security issues should be disclosed privately via [etcd maintainers](mailto:etcd-maintainers@googlegroups.com).
- [X] This is not a support request or question, support requests or questions should be raised in the etcd [discussion forums](https://github.com/etcd-io/etcd/discussions).
- [X] You have read the etcd [bug reporting guidelines](https://github.com/etcd-io/etcd/blob/main/Documentation/contributor-guide/reporting_bugs.md).
- [X] Existing open issues along with etcd [frequently asked questions](https://etcd.io/docs/latest/faq) have been checked and this is not a duplicate.

### What happened?

While working on using `gh` to automate creating the GitHub releases, I noticed that the release script failed when doing v3.6.0 prereleases.

### What did you expect to happen?

It should work but fails because it expects a branch `release-3.6` to exist.

### How can we reproduce it (as minimally and precisely as possible)?

Running the release script with a v3.6.0 version, i.e.:

```bash
$ REPOSITORY=git@github.com:ivanvc/etcd.git DRY_RUN=true ./scripts/release.sh v3.6.0-alpha.2
DRY_RUN=true
RELEASE_VERSION=vv3.6.0-alpha.2
MINOR_VERSION=v3.6
BRANCH=release-v3.6
REPOSITORY=git@github.com:ivanvc/etcd.git

Preparing temporary directory: /tmp/etcd-release-v3.6.0-alpha.2
% (cd ../../../../../../tmp/etcd-release-v3.6.0-alpha.2 && 'git' 'clone' 'git@github.com:ivanvc/etcd.git' '--branch' 'release-v3.6' '--depth' '1')
stderr: Cloning into 'etcd'...
stderr: warning: Could not find remote branch release-v3.6 to clone.
stderr: fatal: Remote branch release-v3.6 not found in upstream origin
```

### Anything else we need to know?

_No response_

### Etcd version (please run commands below)

N/A

### Etcd configuration (command line flags or environment variables)

N/A

### Etcd debug information (please run commands below, feel free to obfuscate the IP address or FQDN in the output)

N/A

### Relevant log output

_No response_


Discussion / hints:
Link to #13538
Thanks @ivanvc for raising this. 

We will cut branch `release-3.6` at a proper timing after we finish all remaining tasks [planned for 3.6](https://docs.google.com/document/d/14PYLcdTyX3jhdBDc6q6WWRceTaIZePauHTWgjHJ0_ZE/edit?tab=t.0). But the release script should also have the ability to release alpha/beta (or RC) versions based on `main` branch directly.

Fix patch:
diff --git a/Documentation/contributor-guide/release.md b/Documentation/contributor-guide/release.md
index ebf0d4d3f0b..266b500d1c4 100644
--- a/Documentation/contributor-guide/release.md
+++ b/Documentation/contributor-guide/release.md
@@ -84,6 +84,10 @@ which don't need to be executed before releasing each version.
    - `git clone --branch release-3.X git@github.com:etcd-io/etcd.git`
 6. Run the release script under the repository's root directory, replacing `${VERSION}` with a value without the `v` prefix, i.e. `3.5.13`.
    - `DRY_RUN=false ./scripts/release.sh ${VERSION}`
+   - **NOTE:** When doing a pre-release (i.e., a version from the main branch, 3.6.0-alpha.2), you will need to explicitly set the branch to main:
+     ```
+     DRY_RUN=false BRANCH=main ./scripts/release.sh ${VERSION}
+     ```
 
    It generates all release binaries under the directory `/tmp/etcd-release-${VERSION}/etcd/release/` and images. Binaries are pushed to the Google Cloud bucket
    under project `etcd-development`, and images are pushed to `quay.io` and `gcr.io`.


Test patch: