add make release bash script (#1475)
* add make release bash script * read me details * uncomment git uncommited changes * typo * tweaks * use package.json as source of truth, not git tags
This commit is contained in:
@ -136,6 +136,11 @@ Before you submit a contribution PR to this repo, please ensure that:
|
|||||||
VERSION=x.y.z yarn run bump-jsons
|
VERSION=x.y.z yarn run bump-jsons
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Alternatively you can try the experimental `make-release.sh` bash script that will create the branch with the updated json files for you.
|
||||||
|
run `./make-release.sh` for a patch update
|
||||||
|
run `./make-release.sh "minor"` for minor
|
||||||
|
run `./make-release.sh "major"` for major
|
||||||
|
|
||||||
The PR may serve as a place to discuss the human-readable changelog and extra QA. A quick way of getting PR's merged since the last bump is to [use this PR filter](https://github.com/KittyCAD/modeling-app/pulls?q=is%3Apr+sort%3Aupdated-desc+is%3Amerged+), open up the browser console and past in the following
|
The PR may serve as a place to discuss the human-readable changelog and extra QA. A quick way of getting PR's merged since the last bump is to [use this PR filter](https://github.com/KittyCAD/modeling-app/pulls?q=is%3Apr+sort%3Aupdated-desc+is%3Amerged+), open up the browser console and past in the following
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
|
69
make-release.sh
Executable file
69
make-release.sh
Executable file
@ -0,0 +1,69 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if ! git diff-index --quiet HEAD --; then
|
||||||
|
echo "Please stash uncommitted changes before running release script"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
git checkout main
|
||||||
|
git pull
|
||||||
|
git fetch --all
|
||||||
|
|
||||||
|
# Get the latest semver tag from git
|
||||||
|
latest_tag=$(jq -r '.version' package.json)
|
||||||
|
latest_tag="v$latest_tag"
|
||||||
|
|
||||||
|
# Print the latest semver tag
|
||||||
|
echo "Latest semver tag: $latest_tag"
|
||||||
|
|
||||||
|
# Function to bump version numbers
|
||||||
|
bump_version() {
|
||||||
|
local version=$1
|
||||||
|
local bump_type=$2
|
||||||
|
local major=$(echo $version | cut -d '.' -f 1 | sed 's/v//')
|
||||||
|
local minor=$(echo $version | cut -d '.' -f 2)
|
||||||
|
local patch=$(echo $version | cut -d '.' -f 3)
|
||||||
|
|
||||||
|
case "$bump_type" in
|
||||||
|
major)
|
||||||
|
major=$((major + 1))
|
||||||
|
minor=0
|
||||||
|
patch=0
|
||||||
|
;;
|
||||||
|
minor)
|
||||||
|
minor=$((minor + 1))
|
||||||
|
patch=0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
patch=$((patch + 1))
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "v${major}.${minor}.${patch}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Determine the type of bump based on the argument
|
||||||
|
bump_type=${1:-patch}
|
||||||
|
|
||||||
|
# Bump the version
|
||||||
|
new_version=$(bump_version $latest_tag $bump_type)
|
||||||
|
|
||||||
|
# Print the new semver tag
|
||||||
|
echo "New semver tag: $new_version"
|
||||||
|
new_version_number=${new_version:1}
|
||||||
|
echo "New version number without 'v': $new_version_number"
|
||||||
|
|
||||||
|
|
||||||
|
git checkout -b "cut-release-$new_version"
|
||||||
|
|
||||||
|
echo "$(jq --arg v "$new_version_number" '.version=$v' package.json --indent 2)" > package.json
|
||||||
|
echo "$(jq --arg v "$new_version_number" '.package.version=$v' src-tauri/tauri.conf.json --indent 2)" > src-tauri/tauri.conf.json
|
||||||
|
|
||||||
|
git add package.json src-tauri/tauri.conf.json
|
||||||
|
git commit -m "Cut release $new_version"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Versions has been bumped in relevant json files, a branch has been created and committed to."
|
||||||
|
echo ""
|
||||||
|
echo "What's left for you to do is, push the branch and make the release PR."
|
||||||
|
echo ""
|
Reference in New Issue
Block a user