sourcegraph/doc/cli
coury-clark 93c73da2c6
release-tool: automate src-cli release in sourcegraph major and minor releases (#48511)
Closes
https://github.com/orgs/sourcegraph/projects/240?pane=issue&itemId=18474973

This PR does a few things:
1. Automates the significant versions (major / minor) src-cli release 
2. Automates the src-cli changelog
3. Provides a command to validate all distribution channels have the
updated version

There is some sequencing trouble in how src-cli is released that is
worth explaining here. So when we perform a release of sourcegraph we
also bake in a minimum src-cli version constant, as well as the
documentation for that version of src-cli. This documentation is
actually generated from the src-cli tool itself, and naively requires
the latest version is available on github.

That's something I don't want to interrupt the release process, so in
this PR we do something slightly different. First, we assume that the
head of main is the release commit, which is reasonable since we are the
ones performing the release. Second, we checkout src-cli and use the
local checkout to bake the documentation into the sourcegraph release.
Third, we perform the src-cli release by tagging the build and pushing
the tag.

To do that this PR also adds a new optional flag into the go program
that installs the software to pass a local path instead of downloading
the latest release.

For some quality of life we autodetect the latest src-cli version from
the src-cli repo instead of assuming it's always the same as the
Sourcegraph version. This is just to hedge against any future
divergence.

Here is an example
[PR](https://github.com/sourcegraph/sourcegraph/pull/48573) after
running the update command (the diff won't necessarily reflect a real
diff)

Using the validate command we can check that github, brew, and npm all
have the latest release that matches the expected version.

## Test plan

To test this I had to do a few janky things:

1. replace the clone path with a constant src-cli path (I just cloned it
once, then grabbed the directory)
2. replace the actual ./release.sh script with something that won't
release. I just edited the script to echo and return early after all the
validations in the same repo above

Here is the output showing the diff and the release script

<img width="1112" alt="image"
src="https://user-images.githubusercontent.com/5090588/222289405-bc1a0632-6af0-4e72-b883-a1cf786f0aec.png">


<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->

To test verify-src-cli simply run the command:
<img width="953" alt="CleanShot 2023-03-02 at 11 35 35@2x"
src="https://user-images.githubusercontent.com/5090588/222552782-72ae3e9f-03dd-4433-9a2b-7356df33849c.png">

And finally a minified example of the full flow
<img width="944" alt="CleanShot 2023-03-02 at 13 55 11@2x"
src="https://user-images.githubusercontent.com/5090588/222552934-7b49aa80-a2ad-4f54-9f27-ab8bf3d1408a.png">
2023-03-03 08:29:38 -07:00
..
explanations add versioning to main docs (#47295) 2023-02-02 00:15:14 -08:00
how-tos docs: Improve readability in code search docs pages (#39717) 2022-08-02 13:36:10 +00:00
references release-tool: automate src-cli release in sourcegraph major and minor releases (#48511) 2023-03-03 08:29:38 -07:00
index.md Move campaigns docs to batch_changes docs (no content changes) (#18854) 2021-03-10 12:56:48 -08:00
quickstart.md Adds note about running src cli through an apache proxy (#47643) 2023-02-15 10:35:42 -06:00