Capact release process
This document describes Capact release process. Currently, it consists of a set of manual steps, however in future it will be automated.
Prerequisites#
Make
Go at least 1.16
UPX tool installed
GoReleaser CLI installed
NOTE: Use the commit SHA, as we use the
no_unique_dist_dirfeature, which was not yet released.go install github.com/goreleaser/goreleaser@b53dbb89d02aa3673782f3d063d7d5039446baac
Steps#
Export environmental variables#
Export environmental variable with the new Capact version:
Use Semantic Versioning 2.0.0 to specify the next Capact release.
export RELEASE_VERSION={major}.{minor}.{patch}export RELEASE_MAJOR_MINOR_VERSION={major}.{minor}
# do not change the following line:export RELEASE_BRANCH=release-${RELEASE_MAJOR_MINOR_VERSION}For example, in case of the 0.3.0 release, it would be:
export RELEASE_VERSION=0.3.0 export RELEASE_MAJOR_MINOR=0.3
# do not change the following line:export RELEASE_BRANCH=release-${RELEASE_MAJOR_MINOR_VERSION}Create a pre-release pull request#
Checkout the destination branch for the pull request.
- For major and minor release versions, set the destination branch to
main. - For patch releases, set the destination to corresponding release branch. For example, for
0.3.1release, checkout therelease-0.3branch.
git checkout {destination-branch}- For major and minor release versions, set the destination branch to
Create and checkout new branch:
git checkout -b prepare-${RELEASE_VERSION}Modify
.github/workflows/branch-build.yamland append new branch to on.push.branches:branches: - "main" - "release-0.2" # (...) - "release-{major}.{minor}" # append the new release branch itemChange versions of all Helm charts:
DEPLOY_DIR=deploy/kubernetes/chartsfor d in ${DEPLOY_DIR}/*/ ; do sed -i.bak "s/^version: .*/version: ${RELEASE_VERSION}/g" "${d}/Chart.yaml"doneChange CLI version:
sed -i.bak "s/Version = .*/Version = \"${RELEASE_VERSION}\"/g" "internal/cli/info.go"Commit the changes and push the branch to origin.
git add .git commit -m "Prepare ${RELEASE_VERSION} release"git push -u origin prepare-${RELEASE_VERSION}Create the pull request from the branch.
- In the pull request description, write the GitHub release notes that will be posted with the release to review.
- As the pull request target branch, pick the proper destination branch from the first step of this section.
Merge the pull request.
Create release branch#
If you release major or minor version, create a dedicated release branch.
Checkout the destination branch and pull the latest changes:
git checkout {destination_branch}git pullCreate a new branch:
git checkout -b ${RELEASE_BRANCH}
Release Helm charts#
Get the latest commit short hash on the destination branch:
export CAPACT_IMAGE_TAG=$(git rev-parse --short HEAD | sed 's/.$//')NOTE: It will be used as a Docker image tag for the release Helm charts. Make sure all the component images with this tag have been built on CI.
Replace default tag for Capact chart:
sed -i.bak "s/overrideTag: \"latest\"/overrideTag: \"${CAPACT_IMAGE_TAG}\"/g" "deploy/kubernetes/charts/capact/values.yaml"Replace Populator target branch from
mainto the release branch:sed -i.bak "s/branch: main/branch: ${RELEASE_BRANCH}/g" "deploy/kubernetes/charts/capact/charts/hub-public/values.yaml"Review and commit the changes:
git add .git commit -m "Set fixed Capact image tag and Populator source branch"Release Helm charts:
make release-charts
Create new git tag and publish binaries#
Create new tag and push it and release branch to origin:
NOTE: Git tag is in a form of SemVer version with
vprefix, such asv0.3.0.git tag v${RELEASE_VERSION} HEADReview the changes you've made and push the release branch with tag to origin:
git push -u origin ${RELEASE_BRANCH}git push origin v${RELEASE_VERSION}Release tools binaries:
NOTE: GoReleaser uses the git tag as binaries version.
make release-binaries
Create GitHub release#
- Navigate to the New GitHub release page.
- Copy the release notes from the pull request created in the Create a pre-release pull request section.
- Create the new GitHub release with the copied notes.
Release documentation#
If you release a new major or minor Capact version, follow these steps:
Clone the
websiterepository locally.Follow instructions from the
README.mddocument to fulfill all prerequisites.Create and checkout new branch:
git checkout -b prepare-${RELEASE_MAJOR_MINOR_VERSION}Synchronize Capact CLI documentation according to the Synchronize CLI documentation section.
Run the following command:
npm run docusaurus docs:version ${RELEASE_MAJOR_MINOR_VERSION}Update redirects in the
redirects.jsfile to make sure we point to proper documents for all documentation versions:For example, for
0.3release, change the line:...generateDocsRedirectsForVersion("0.2", ""), // redirect from 0.2 to latestto:
...generateDocsRedirectsForVersion("0.2"),...generateDocsRedirectsForVersion("0.3", ""), // redirect from 0.3 to latestUpdate stable release version for Capact binaries:
sed -i.bak "s/capactio-binaries\/v\([0-9]*\.[0-9]*\.[0-9]*\)/capactio-binaries\/v${RELEASE_VERSION}/g" ./docs/cli/getting-started.mdxsed -i.bak "s/capact-cli:v\([0-9]*\.[0-9]*\.[0-9]*\)/capact-cli:v${RELEASE_VERSION}/g" ./docs/cli/getting-started.mdxCommit and push the changes
git add .git commit -m "Release ${RELEASE_MAJOR_MINOR_VERSION} documentation"git push -u origin prepare-${RELEASE_MAJOR_MINOR_VERSION}Create a new pull request for the
websiterepository.Merge the pull request.
To read more about documentation versioning, see the Versioning page on the Docusaurus website.