1
1
#! /usr/bin/env bash
2
2
3
3
# This script prepares for a release. Run it with the release version as the first argument and it
4
- # will update version numbers, commit and add a signed tag .
4
+ # will update version numbers, update the changelog, and update copyright year .
5
5
6
6
set -eu
7
7
8
8
SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
9
9
cd " $SCRIPT_DIR "
10
10
11
- REPO_ROOT=../../
11
+ REPO_ROOT=../../../
12
12
13
13
source $REPO_ROOT /scripts/utils/log
14
+ source $REPO_ROOT /scripts/utils/print-and-run
14
15
15
- PUSH_TAG=" false"
16
16
17
17
for argument in " $@ " ; do
18
18
case " $argument " in
19
- --push-tag) PUSH_TAG=" true" ;;
20
19
-* )
21
20
log_error " Unknown option \" $argument \" "
22
21
exit 1
@@ -27,15 +26,10 @@ for argument in "$@"; do
27
26
esac
28
27
done
29
28
30
- changes_path=.. /packages/mullvad-vpn/changes.txt
29
+ changes_path=$REPO_ROOT /desktop /packages/mullvad-vpn/changes.txt
31
30
changelog_path=$REPO_ROOT /CHANGELOG.md
32
31
product_version_path=$REPO_ROOT /dist-assets/desktop-product-version.txt
33
32
34
- function print_and_run {
35
- echo " + $* "
36
- " $@ "
37
- }
38
-
39
33
function checks {
40
34
if [[ -z ${PRODUCT_VERSION+x} ]]; then
41
35
log_error " Please give the release version as an argument to this script."
@@ -88,7 +82,9 @@ function check_changelog {
88
82
89
83
function update_copyright_year {
90
84
$REPO_ROOT /scripts/update-copyright
91
- print_and_run git commit -A -S -m " Update copyright year in project files and code"
85
+ if [[ $( git diff --shortstat 2> /dev/null | tail -n1) != " " ]]; then
86
+ print_and_run git commit -a -S -m " Update copyright year in project files and code"
87
+ fi
92
88
}
93
89
94
90
function update_changelog {
@@ -107,31 +103,18 @@ function update_product_version {
107
103
$product_version_path
108
104
}
109
105
110
- function push_tag {
111
- product_version=$( echo -n " $( cat $product_version_path ) " )
112
- echo " Tagging current git commit with release tag $product_version ..."
113
- print_and_run git tag -s " $product_version " -m " $product_version "
114
- print_and_run git push origin " $product_version "
115
- log_success " \nTag pushed!"
116
- }
117
-
118
- if [[ $PUSH_TAG == " true" ]]; then
119
- check_commit_signature
120
- push_tag
121
- else
122
- checks
123
- check_commit_signature
124
- check_changelog
125
- update_changelog
126
- update_copyright_year
127
- update_product_version
128
-
129
- log_success " \n================================================="
130
- log_success " | DONE preparing for a release! |"
131
- log_success " | Now verify that everything looks correct |"
132
- log_success " | and then create and push the tag by |"
133
- log_success " | running: |"
134
- log_success " | $ $0 \\ "
135
- log_success " | --push-tag |"
136
- log_success " ================================================="
137
- fi
106
+ checks
107
+ check_commit_signature
108
+ check_changelog
109
+ update_changelog
110
+ update_copyright_year
111
+ update_product_version
112
+
113
+ log_success " \n================================================="
114
+ log_success " | DONE preparing for a release! |"
115
+ log_success " | Now verify that everything looks correct |"
116
+ log_success " | and then create and push the tag by |"
117
+ log_success " | running: |"
118
+ log_success " | $ $0 \\ "
119
+ log_success " | --push-tag |"
120
+ log_success " ================================================="
0 commit comments