Skip to content

Commit

Permalink
Release documentation (#151)
Browse files Browse the repository at this point in the history
Updated release documentation

---------

Co-authored-by: Tomasz Gołębiowski <[email protected]>
  • Loading branch information
tomaszgolebiowski and Tomasz Gołębiowski authored Nov 27, 2024
1 parent fec8f9c commit 72af86b
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 42 deletions.
68 changes: 26 additions & 42 deletions docs/dev/Release.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@

# Releases

Version number format follows [Semantic Versioning](https://semver.org/) of <major>.<minor>.<patch>.
Version number format: MAJOR.MINOR.PATH. Version numbering is automatic and uses the branch naming convention. For more details read [versioning.md](./versioning.md)
- preview version has an odd MINOR number
- release version has an even MINOR number

## Preview release

Follow these steps to publish a new preview to the [Private feed](https://sourcegraph.github.io/cody-vs/feed.xml).

1. **Create release branch**: Branch name must follow convention `vs-vMAJOR.MINOR.x` where MINOR must be even number `git checkout -b vs-vMAJOR.MINOR.x`. NOTE: Although the MINOR number will be even in the branch name the preview version of the extension will have an odd number (MINOR -1)
2. **Start publication**: Go to https://github.com/sourcegraph/cody-vs/actions/workflows/publish.yml and run workflow manually using following parameters:
- Use workflow from: release branch
- Publish type: Preview
4. **Monitor Publication**: Once the workflow run is complete:
- The new version of the extension will be published to the [Private feed](https://sourcegraph.github.io/cody-vs/feed.xml).
- A pre-release will be created on GitHub.

## Stable release

Expand All @@ -10,55 +24,25 @@ NOTE: All releases are currently published automatically via GitHub Actions as P
Follow these steps to publish a new release to the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=sourcegraph.cody-vs).

1. **Coordinate with Marketing**: Contact the Marketing team in the Cody Slack channel approximately 2 days before the release to ensure a blog post is prepared.
2. **Update Extension Package Version**: Increment the version in [source.extension.vsixmanifest](../../src/Cody.VisualStudio/source.extension.vsixmanifest) and [CHANGELOG.md](../../CHANGELOG.md).
3. **Commit the Version Changes**: Commit the version increment with a message with `git commit -m Release vX.Y.Z`
4. **Create Pull Request**: Open a PR with the updated version.
5. **Tag the Release**: After the PR is merged (stable release only), create a git tag: `git tag vX.Y.Z`
6. **Push the Tag**: Push the tag to the remote repository to trigger the [Release workflow](https://github.com/sourcegraph/cody-vs/actions/workflows/release-preview.yml): `git push --tags`
7. **Monitor Publication**: Once the workflow run is complete:
2. **Create release branch**: Branch name must follow convention `vs-vMAJOR.MINOR.x` where MINOR must be even number `git checkout -b vs-vMAJOR.MINOR.x`. Consider that the branch may already exist and be used to publish a preview version. In this case, you don't need to create a new branch just use an existing one.
3. **Update changelog file** Add changes to [CHANGELOG.md](../../CHANGELOG.md). Commit and push changes to the release branch
3. **Start publication**: Go to https://github.com/sourcegraph/cody-vs/actions/workflows/publish.yml and run workflow manually using following parameters:
- Use workflow from: release branch
- Publish type: Release
4. **Monitor Publication**: Once the workflow run is complete:
- The new version of the extension will be published to the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=sourcegraph.cody-vs).
- A release will be created on GitHub with the release notes.

### Release checklist

Include the following checklist in the PR description when creating a new release.

```markdown
Release Checklist:
- [ ] Update version number
- [ ] Update [CHANGELOG.md](./CHANGELOG.md)
- [ ] Link to PR for the release blog post (if any)
```

Note: Ensure all checklist items are completed before merging the release PR.
- A release will be created on GitHub.

## Patch release

A patch release is necessary when a critical bug is discovered in the latest stable release that requires an immediate fix.

To publish a **patch** release:

1. Ensure all the changes for the patch are already committed to the `main` branch.
2. Check out the `main` branch and update the tags: `git fetch --tags`
3. Create a new branch for the patch release based on the tag of the latest release: `git checkout -b v<patch> v<latest>`
4. Replace <latest> with the latest stable release version, and <patch> should be the latest version incremented by 1: `git checkout -b v1.2.4 v1.2.3`
5. Cherry-pick the commits for the patch release into the patch branch: `git cherry-pick <commit-hash>`
6. Follow the steps for a stable release starting from step 2 to publish the patch release.

IMPORTANT: You do not need to merge the patch branch back into `main` as it is a temporary branch. However, you will need to update the version number in the `main` branch after the patch release is published.

## Nightly build

Nightly build is currently not supported.

## Running a release build locally
1. Ensure all the changes for the patch are already committed to the latest release branch.
2. **Start publication**: Go to https://github.com/sourcegraph/cody-vs/actions/workflows/publish.yml and run workflow manually using following parameters:
- Use workflow from: release banch
- Publish type: Release

It can be helpful to build and run the packaged extension locally to replicate a typical user flow.

To do this:

1. Set the target branch / commit in build.cake.
2. Run `cd src; dotnet cake`.
3. Open the [src/Cody.sln](src/Cody.sln) file in Visual Studio.
4. Right click on the [Cody.Visual Studio](src/Cody.VisualStudio/) project and select `Rebuild Project`.
5. Once the project is built, it will create a `Cody.VisualStudio.vsix` file in the `src/Cody.VisualStudio/bin/Debug` folder, which you can double-click to install the extension.
73 changes: 73 additions & 0 deletions docs/dev/versioning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Visual Studio Cody client versioning

## Distribution channels
- **Nightly** Every day, a version of the extension is built containing the latest changes from the main branch and using the latest stable version of the agent. The version built from this channel is not distributed anywhere, so it is not assigned a version number. It can be downloaded from the GitHub Actions artifacts for each run.
- **Preview** This version is intended for QA testing and is also available to insiders who are interested in early versions. The version is distributed to GitHub Release and to a private feed (https://sourcegraph.github.io/cody-vs/feed.xml)
- **Release (production)** Stable version available in GitHub Release and in Visual Studio Marketplace.

## Versioning
Visual Studio extensions do not support semantic versioning. Only version numbers containing digits are accepted. Therefore, it became necessary to separate versioning for preview and release versions. The **preview version has an odd minor number**, while the **release version has an even minor number**. The numbering is shared between the preview and release versions. Therefore, it is important for subsequently numbered versions of the extension to have a semantically larger version number.
Examples:
- ❌1.23.3-beta1
- ❌v0.3.3
- ❌3.0
- ✅3.0.0
- ✅0.1.24

## Branch Naming Convention
Each branch from which the next version is to be created should follow the format: vs-vMAJOR.MINOR.x
where **MINOR must be an even positive number**. MAJOR can be any positive number.
Examples:
- ✅vs-v0.12.x
- ✅vs-v2.22.x
- ❌vs-0.12.x
- ❌vs-v0.12.0
- ❌vs-v0.3.x

## Version auto-numbering
During the publishing process, a new version number is generated automatically. The numbering is determined based on the branch name and whether it is a preview or production version. Version follow the format: MAJOR.MINOR.PATH

### For the preview version
MAJOR - remains the same as the MAJOR from the branch\
MINOR - the MINOR from the branch minus one\
PATCH - the next available number starting from 0 (determined based on existing tags)\
Example: branch `vs-v0.12.x` -> version `0.11.0` (next version `0.11.1`, next next version `0.11.2`)

Special case:
When MINOR is 0, e.g., the branch name is vs-v2.0.x. In this case:\
MAJOR - the MAJOR from the branch minus one\
MINOR - is set to 999\
PATCH - the next available number starting from 0\
Example: branch `vs-v2.0.x` -> version `1.999.0` (next version `1.999.1`, next next version `1.999.2`)

### For a release version
MAJOR - is the same as the MAJOR from the branch\
MINOR - is the same as the MINOR from the branch\
PATCH - the next available number starting from 0 (determined based on existing tags)\
Example: branch `vs-v0.12.x` -> version `0.12.0` (next version `0.12.1`, next next version `0.12.2`)
> [!NOTE]
> PATH for each branch and version (preview and release) is calculated separately!
## Tags
An element of the publication process is the automatic addition of a tag indicating the version being published.
- preview version e.g. `vs-insiders-v0.1.0`
- release version e.g. `vs-v.0.2.1`

## Setting the agent version
The agent version can be set independently from the extension version. This is done by editing the `agent/agent.version` file in the repository. Acceptable values include the branch name, tag or commit hash from the Cody repository. It is recommended to use only tags, as they indicate a specific stable version of the agent.

## Release Captain responsibilities
- Upgrate agent version if needed
- Create and push branch with proper naming
- Run Publish workflow with the selected branch and type of publication (preview or release)

## Example release scenario
You are the release captain, and your task is to publish a new version of Cody for Visual Studio. To do this, you select the latest commit from the repository that will be included in the new version and create a release branch. The name of this branch is important as it will be used to generate the version number. Upon checking the tags, you found that the last stable version is `0.8.1`. Therefore, the name of the new release branch will be `vs-v0.10.x`. Before publishing the final version, you always conduct QA tests. For this, a preview version is required. You create it by running the 'Publish' workflow in GitHub Actions (select branch `vs-v0.10.x` and type 'Preview'). The published preview version will have the number `0.9.0`. It will be tagged in the repository as `vs-insiders-v0.9.0`. You ask the QA team to conduct the tests.

One of the QA team members discovers a issue. You verify the information, and it is indeed a bug that needs fixing. The developers will take care of this. After preparing the fix, another verification is necessary, so you publish a new preview version. You ensure that the commit containing the fix is on the `vs-v0.10.x` branch and, just like the first time, run the 'Publish' workflow. The new preview version will be numbered `0.9.1` and will be tagged as `vs-insiders-v0.9.1`. You pass the version information to the QA team. This time, the tests go smoothly, and the team does not report any issues. We are ready to publish the stable version.

You inform the involved teams that you intend to publish the new version. It will be widely available in the Visual Studio Marketplace. To do this, you run the 'Publish' workflow, similar to before. You select the branch `vs-v0.10.x`, but this time you choose 'Release' as the type. The new stable version will be numbered `0.10.0` and will be tagged in the repository as `vs-v0.10.0`. After publishing, you verify its availability in the Visual Studio Marketplace. You know that sometimes the published version appears with a delay of several minutes.

A few days after the stable release, one of the extension's users reports a issue. You verify the report. It is not a serious issue, but you don't want the user to wait for a fix until the next major release. You assign the fix. Before publishing, you ensure that the commit with the fix is on the `vs-v0.10.x` branch. You can now publish another preview version (which would be numbered `0.9.2`) and pass it for QA, or if the change was minimal and low-risk, you can immediately publish a stable version. You choose the latter. The new stable version will be numbered `0.10.1`.

By following these scenario, a structured approach is taken to release management, ensuring quality and timely updates for the users.

0 comments on commit 72af86b

Please sign in to comment.