From 3a3edeea088842bce67e2db8808c1dd07d75b412 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 12 May 2021 08:03:45 -0400 Subject: [PATCH] Add tag command, update guide, add PR templates (#2679) --- .github/PULL_REQUEST_TEMPLATE/default.md | 5 +++++ .github/PULL_REQUEST_TEMPLATE/release.md | 13 +++++++++++++ Makefile | 4 ++++ RELEASE_GUIDE.md | 24 +++++++++++++++++------- package.json | 2 +- scripts/tag-release.sh | 10 ++++++++++ 6 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 .github/PULL_REQUEST_TEMPLATE/default.md create mode 100644 .github/PULL_REQUEST_TEMPLATE/release.md create mode 100755 scripts/tag-release.sh diff --git a/.github/PULL_REQUEST_TEMPLATE/default.md b/.github/PULL_REQUEST_TEMPLATE/default.md new file mode 100644 index 0000000000..a54a6ef38c --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/default.md @@ -0,0 +1,5 @@ +Fixes # + +**Description of changes:** + +- diff --git a/.github/PULL_REQUEST_TEMPLATE/release.md b/.github/PULL_REQUEST_TEMPLATE/release.md new file mode 100644 index 0000000000..11e5822025 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/release.md @@ -0,0 +1,13 @@ +## Changes since v + +## 🚀 Features + +* + +## 🐛 Bug Fixes + +* + +## 🧰 Maintenance + +* diff --git a/Makefile b/Makefile index d2b7cc9dd8..d7223e2bc7 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,10 @@ lint: release-version: npm version $(CMD_ARGS) --git-tag-version false +.PHONY: tag-release +tag-release: + scripts/tag-release.sh + .PHONY: test test: binaries/client yarn run jest $(or $(CMD_ARGS), "src") diff --git a/RELEASE_GUIDE.md b/RELEASE_GUIDE.md index da4bf01d94..5fdc1efa32 100644 --- a/RELEASE_GUIDE.md +++ b/RELEASE_GUIDE.md @@ -2,10 +2,20 @@ Lens releases are built by CICD automatically on git tags. The typical release process flow is the following: -1. Create a release branch `release/v{version}` from `master` branch or from existing release branch (for example, `release/v3.5`) on patch releases. -2. Update changelog in `static/RELEASE_NOTES.md` and bump version in `package.json`. -3. Create PR and put change log in description field. -4. After the PR is accepted, create a tag from release branch. -5. Push tag to GitHub. -6. Publish automatically created GitHub release. -7. Merge the release PR after the release is published and delete the release branch from GitHub. \ No newline at end of file +1. From a clean and up to date `master` run `make release-version ` where `` is one of the following: + - `major` + - `minor` + - `patch` + - `premajor` + - `preminor` + - `prepatch` + - `prerelease [--preid=]` + - where `` is generally one of: + - `alpha` + - `beta` + - `rc` +1. Create PR (git should have printed a link to GitHub in the console) with the contents of all the accepted PRs since the last release. +1. After the PR is accepted and passes CI. Go to the same branch and run `make tag-release` +1. Once CI passes again go to the releases tab on GitHub, create a new release from the tag that was created, make sure that the change log is the same as that of the PR. +1. Merge the release PR after the release is published. GitHub should delete the branch once it is merged. +1. If you have just released a new major or minor version then create a new `vMAJOR.MINOR` branch from that same tag and push it to master. This will be the target for future patch releases and shouldn't be deleted. diff --git a/package.json b/package.json index a30388587f..5d2d231392 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "version-checkout": "cat package.json | jq '.version' -r | xargs printf \"release/v%s\" | xargs git checkout -b", "version-commit": "cat package.json | jq '.version' -r | xargs printf \"release v%s\" | git commit --no-edit -s -F -", "version": "yarn run version-checkout && git add package.json && yarn run version-commit", - "postversion": "git push --set-upstream origin release/v$npm_package_version" + "postversion": "git push --set-upstream ${GIT_REMOTE:-origin} release/v$npm_package_version" }, "config": { "bundledKubectlVersion": "1.18.15", diff --git a/scripts/tag-release.sh b/scripts/tag-release.sh new file mode 100755 index 0000000000..3a32bd3189 --- /dev/null +++ b/scripts/tag-release.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +if [[ ${git branch --show-current} =~ ^release/v ]] +then + VERSION_STRING=$(cat package.json | jq '.version' -r | xargs printf "v%s") + git tag ${VERSION_STRING} + git push ${GIT_REMOTE:-origin} ${VERSION_STRING} +else + echo "You must be in a release branch" +fi