Skip to content

Commit 3e788fc

Browse files
committed
Update Android prepare release script
1 parent 0a45b64 commit 3e788fc

File tree

1 file changed

+17
-65
lines changed

1 file changed

+17
-65
lines changed

android/scripts/prepare-release.sh

+17-65
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,11 @@
55

66
set -eu
77

8-
ANDROID="false"
9-
DESKTOP="false"
10-
VERSION_METADATA_ARGS=""
8+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
9+
cd "$SCRIPT_DIR/../.."
1110

1211
for argument in "$@"; do
1312
case "$argument" in
14-
"--android")
15-
ANDROID="true"
16-
;;
17-
"--desktop")
18-
DESKTOP="true"
19-
VERSION_METADATA_ARGS+="--desktop "
20-
;;
2113
-*)
2214
echo "Unknown option \"$argument\""
2315
exit 1
@@ -34,80 +26,40 @@ if [[ -z ${PRODUCT_VERSION+x} ]]; then
3426
exit 1
3527
fi
3628

37-
if [[ "$ANDROID" != "true" && "$DESKTOP" != "true" ]]; then
38-
echo "Please specify if the release is for the desktop app and/or for Android app."
39-
echo "For example: --android --desktop"
40-
exit 1
41-
fi
42-
4329
if [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]]; then
4430
echo "Dirty working directory! Will not accept that for an official release."
4531
exit 1
4632
fi
4733

48-
desktop_changes_path=desktop/packages/mullvad-vpn/changes.txt
49-
if [[ $DESKTOP == "true" && $(grep "CHANGE THIS BEFORE A RELEASE" $desktop_changes_path) != "" ]]; then
50-
echo "It looks like you did not update $desktop_changes_path"
51-
exit 1
52-
fi
53-
54-
if [[ "$DESKTOP" == "true" && $(grep "^## \\[$PRODUCT_VERSION\\] - " CHANGELOG.md) == "" ]]; then
55-
echo "It looks like you did not add $PRODUCT_VERSION to the changelog?"
56-
echo "Please make sure the changelog is up to date and correct before you proceed."
57-
exit 1
58-
fi
59-
60-
if [[ "$ANDROID" == "true" &&
61-
$PRODUCT_VERSION != *"alpha"* &&
34+
if [[ $PRODUCT_VERSION != *"alpha"* &&
6235
$(grep "^## \\[android/$PRODUCT_VERSION\\] - " android/CHANGELOG.md) == "" ]]; then
6336

6437
echo "It looks like you did not add $PRODUCT_VERSION to the changelog?"
6538
echo "Please make sure the changelog is up to date and correct before you proceed."
6639
exit 1
6740
fi
6841

69-
if [[ "$ANDROID" == "true" ]]; then
70-
echo "Generate relays.json"
71-
mkdir dist-assets/relays
72-
cargo run -q -p mullvad-api --bin relay_list > dist-assets/relays/relays.json
73-
74-
git commit -S -m "Add relay list to bundle with $PRODUCT_VERSION" \
75-
dist-assets/relays/relays.json
76-
fi
77-
78-
if [[ "$DESKTOP" == "true" ]]; then
79-
echo "$PRODUCT_VERSION" > dist-assets/desktop-product-version.txt
80-
git commit -S -m "Update desktop app version to $PRODUCT_VERSION" \
81-
dist-assets/desktop-product-version.txt
82-
fi
42+
echo "Generate relays.json"
43+
mkdir dist-assets/relays
44+
cargo run -q -p mullvad-api --bin relay_list > dist-assets/relays/relays.json
8345

84-
if [[ "$ANDROID" == "true" ]]; then
85-
echo "$PRODUCT_VERSION" > dist-assets/android-version-name.txt
86-
ANDROID_VERSION="$PRODUCT_VERSION" cargo run -q --bin mullvad-version versionCode > \
87-
dist-assets/android-version-code.txt
88-
git commit -S -m "Update android app version to $PRODUCT_VERSION" \
89-
dist-assets/android-version-name.txt \
90-
dist-assets/android-version-code.txt
91-
fi
46+
git commit -S -m "Add relay list to bundle with $PRODUCT_VERSION" \
47+
dist-assets/relays/relays.json
9248

93-
NEW_TAGS=""
49+
echo "$PRODUCT_VERSION" > dist-assets/android-version-name.txt
50+
ANDROID_VERSION="$PRODUCT_VERSION" cargo run -q --bin mullvad-version versionCode > \
51+
dist-assets/android-version-code.txt
52+
git commit -S -m "Update android app version to $PRODUCT_VERSION" \
53+
dist-assets/android-version-name.txt \
54+
dist-assets/android-version-code.txt
9455

95-
if [[ "$ANDROID" == "true" ]]; then
96-
echo "Tagging current git commit with release tag android/$PRODUCT_VERSION..."
9756

98-
git tag -s "android/$PRODUCT_VERSION" -m "android/$PRODUCT_VERSION"
99-
NEW_TAGS+=" android/$PRODUCT_VERSION"
100-
fi
101-
if [[ "$DESKTOP" == "true" ]]; then
102-
echo "Tagging current git commit with release tag $PRODUCT_VERSION..."
103-
104-
git tag -s "$PRODUCT_VERSION" -m "$PRODUCT_VERSION"
105-
NEW_TAGS+=" $PRODUCT_VERSION"
106-
fi
57+
echo "Tagging current git commit with release tag android/$PRODUCT_VERSION..."
58+
git tag -s "android/$PRODUCT_VERSION" -m "android/$PRODUCT_VERSION"
10759

10860
echo "================================================="
10961
echo "| DONE preparing for a release! |"
11062
echo "| Now push the tag created by this script |"
11163
echo "| after you have verified it is correct: |"
112-
echo "| $ git push origin$NEW_TAGS"
64+
echo "| $ git push origin $PRODUCT_VERSION"
11365
echo "================================================="

0 commit comments

Comments
 (0)