Skip to content

Commit 612aad8

Browse files
committed
Merge branch 'improve-desktop-release-scripts'
2 parents dbfc02c + 04a80a4 commit 612aad8

8 files changed

+135
-77
lines changed

desktop/scripts/prepare-release.sh desktop/scripts/release/1-prepare-release

+22-39
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
#!/usr/bin/env bash
22

33
# 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.
55

66
set -eu
77

88
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
99
cd "$SCRIPT_DIR"
1010

11-
REPO_ROOT=../../
11+
REPO_ROOT=../../../
1212

1313
source $REPO_ROOT/scripts/utils/log
14+
source $REPO_ROOT/scripts/utils/print-and-run
1415

15-
PUSH_TAG="false"
1616

1717
for argument in "$@"; do
1818
case "$argument" in
19-
--push-tag) PUSH_TAG="true" ;;
2019
-*)
2120
log_error "Unknown option \"$argument\""
2221
exit 1
@@ -27,15 +26,10 @@ for argument in "$@"; do
2726
esac
2827
done
2928

30-
changes_path=../packages/mullvad-vpn/changes.txt
29+
changes_path=$REPO_ROOT/desktop/packages/mullvad-vpn/changes.txt
3130
changelog_path=$REPO_ROOT/CHANGELOG.md
3231
product_version_path=$REPO_ROOT/dist-assets/desktop-product-version.txt
3332

34-
function print_and_run {
35-
echo "+ $*"
36-
"$@"
37-
}
38-
3933
function checks {
4034
if [[ -z ${PRODUCT_VERSION+x} ]]; then
4135
log_error "Please give the release version as an argument to this script."
@@ -88,7 +82,9 @@ function check_changelog {
8882

8983
function update_copyright_year {
9084
$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
9288
}
9389

9490
function update_changelog {
@@ -107,31 +103,18 @@ function update_product_version {
107103
$product_version_path
108104
}
109105

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 "================================================="
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
# This script creates and pushes a signed release tag. This should be run after `1-prepare-release`.
4+
5+
set -eu
6+
7+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
8+
cd "$SCRIPT_DIR"
9+
10+
REPO_ROOT=../../../
11+
PRODUCT_VERSION_PATH=$REPO_ROOT/dist-assets/desktop-product-version.txt
12+
PRODUCT_VERSION=$(cat $PRODUCT_VERSION_PATH)
13+
14+
source $REPO_ROOT/scripts/utils/print-and-run
15+
source $REPO_ROOT/scripts/utils/log
16+
17+
function push_tag {
18+
product_version=$(echo -n "$PRODUCT_VERSION")
19+
echo "Tagging current git commit with release tag $product_version..."
20+
print_and_run git tag -s "$product_version" -m "$product_version"
21+
git push
22+
print_and_run git push origin "$product_version"
23+
log_success "\nTag pushed!"
24+
}
25+
26+
git verify-commit HEAD
27+
push_tag
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
3+
# This script verifies the build produced by the buildserver. It helps the user verify the staging
4+
# repository versions and triggers a e2e run with a small subset of the tests to verify the build.
5+
# This should be be run after `2-push-release-tag` and after the build server has finished building.
6+
7+
set -eu
8+
9+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
10+
cd "$SCRIPT_DIR"
11+
12+
REPO_ROOT=../../../
13+
PRODUCT_VERSION_PATH=$REPO_ROOT/dist-assets/desktop-product-version.txt
14+
PRODUCT_VERSION=$(cat $PRODUCT_VERSION_PATH)
15+
16+
$REPO_ROOT/scripts/utils/gh-ready-check
17+
source $REPO_ROOT/scripts/utils/log
18+
19+
function verify_repository_versions {
20+
print_versions_args=( --staging )
21+
22+
if [[ "$PRODUCT_VERSION" == *-beta* ]]; then
23+
print_versions_args+=( --beta )
24+
fi
25+
26+
./print-package-versions "${print_versions_args[@]}"
27+
read -r -n 1 -p "Does the versions look correct? (y/N): " response
28+
printf "\n\n"
29+
30+
if [[ "$response" =~ ^[Yy]$ ]]; then
31+
return
32+
elif [[ "$response" =~ ^[Nn]$ ]]; then
33+
log_info "Aborting"
34+
exit 1
35+
else
36+
log_error "Invalid response"
37+
exit 1
38+
fi
39+
}
40+
41+
verify_repository_versions
42+
gh workflow run desktop-e2e.yml --ref "$PRODUCT_VERSION" \
43+
-f oses="fedora41 ubuntu2404 windows11 macos15" \
44+
-f tests="test_quantum_resistant_tunnel test_ui_tunnel_settings"

desktop/scripts/make-release desktop/scripts/release/4-make-release

+9-13
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
#!/usr/bin/env bash
22

3+
# This script downloads the build artifacts along with the signatures, verifies the signatures and
4+
# creates a GitHub draft release. This should be run after `3-verify-build`.
5+
36
set -eu
47

5-
if ! command -v gh > /dev/null; then
6-
echo >&2 "gh (GitHub CLI) is required to run this script"
7-
exit 1
8-
fi
8+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
9+
cd "$SCRIPT_DIR"
910

10-
if ! gh auth status > /dev/null; then
11-
echo >&2 "Authentication through gh (GitHub CLI) is required to run this script"
12-
exit 1
13-
fi
11+
REPO_ROOT=../../../
12+
PRODUCT_VERSION_PATH=$REPO_ROOT/dist-assets/desktop-product-version.txt
13+
PRODUCT_VERSION=$(cat $PRODUCT_VERSION_PATH)
1414

15-
if [[ $# != 1 ]]; then
16-
echo "!!! Please pass the app version as the first and only argument"
17-
exit 1
18-
fi
15+
$REPO_ROOT/scripts/utils/gh-ready-check
1916

20-
PRODUCT_VERSION=$1
2117
REPO_URL="git@github.com:mullvad/mullvadvpn-app"
2218
ARTIFACT_DIR=$(mktemp -d)
2319
REPO_DIR=$(mktemp -d)

desktop/scripts/print-package-versions.sh desktop/scripts/release/print-package-versions

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2727
cd "$SCRIPT_DIR"
2828

2929
# shellcheck source=ci/linux-repository-builder/build-linux-repositories-config.sh
30-
source build-linux-repositories-config.sh
30+
source ../../../ci/linux-repository-builder/build-linux-repositories-config.sh
3131
# shellcheck source=scripts/utils/log
32-
source ../../scripts/utils/log
32+
source ../../../scripts/utils/log
3333

3434
deb="false"
3535
rpm="false"

desktop/scripts/test-release-artifacts

-23
This file was deleted.

scripts/utils/gh-ready-check

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
# This script controls that the gh (GitHub CLI) command is installed and authenticated. This can be
4+
# called in the beginning of all scripts depending on gh.
5+
6+
set -eu
7+
8+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
9+
cd "$SCRIPT_DIR"
10+
11+
# shellcheck source=scripts/utils/log
12+
source ./log
13+
14+
if ! command -v gh > /dev/null; then
15+
log_error "gh (GitHub CLI) is required to run this script"
16+
exit 1
17+
fi
18+
19+
if ! gh auth status > /dev/null; then
20+
log_error "Authentication through gh (GitHub CLI) is required to run this script"
21+
exit 1
22+
fi

scripts/utils/print-and-run

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
# This is a small utility script that can be sourced to provide a function that prints its arguments
4+
# and then calls them as a command, e.g. `print_and_run sleep 5`.
5+
6+
function print_and_run {
7+
echo "+ $*"
8+
"$@"
9+
}

0 commit comments

Comments
 (0)