forked from gaelj/BlazorCodeMirror6
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake-release.sh
More file actions
executable file
·51 lines (42 loc) · 1.51 KB
/
make-release.sh
File metadata and controls
executable file
·51 lines (42 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
# This script is used to generate a new release.
# Usage: ./make-release.sh
# Ask the user if they want to generate a changelog
echo "Do you want to generate a changelog?"
select yn in "Yes" "No"; do
case $yn in
Yes ) generate_changelog=true; break;;
No ) generate_changelog=false; break;;
esac
done
if [ "$generate_changelog" = true ] ; then
# generate the changelog
./make-changelog.sh
# Ask the user to confirm the changelog contents
echo "Please review NEW_CHANGELOG.md"
read -r -p "Press enter to continue"
fi
# print latest tag
last_version=$(git describe --tags --abbrev=0 "$(git rev-list --tags --max-count=1)")
echo "Current version: $last_version"
# Ask if the user wants a major, minor or patch release
echo "What kind of release is this?"
select yn in "major" "minor" "patch"; do
case $yn in
patch ) new_version=$(semver bump patch "$last_version"); break;;
minor ) new_version=$(semver bump minor "$last_version"); break;;
major ) new_version=$(semver bump major "$last_version"); break;;
esac
done
echo "New version: $new_version"
# Update main changelog
sed -i "3i## $new_version - $(date +%Y-%m-%d)\n\n" CHANGELOG.md
sed -i '4r NEW_CHANGELOG.md' CHANGELOG.md
git add ./*CHANGELOG.md
git commit -m "📝 Update changelog for $new_version"
# Bump version in all .csproj files
dotnet tool restore
dotnet setversion -r "$new_version"
git add ./**/*.csproj
git commit -m "🔖 Bump version to $new_version"