2024-02-19 01:03:01 +02:00
|
|
|
#!/usr/bin/env bash
|
2023-01-24 05:46:37 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Pump one or both of the server/mobile versions in appropriate files
|
|
|
|
#
|
2023-01-24 17:26:58 +02:00
|
|
|
# usage: './scripts/pump-version.sh -s <major|minor|patch> <-m>
|
2023-01-24 05:46:37 +02:00
|
|
|
#
|
|
|
|
# examples:
|
2023-02-02 08:53:22 +02:00
|
|
|
# ./scripts/pump-version.sh -s major # 1.0.0+50 => 2.0.0+50
|
2023-01-24 17:26:58 +02:00
|
|
|
# ./scripts/pump-version.sh -s minor -m # 1.0.0+50 => 1.1.0+51
|
|
|
|
# ./scripts/pump-version.sh -m # 1.0.0+50 => 1.0.0+51
|
2023-01-24 05:46:37 +02:00
|
|
|
#
|
|
|
|
|
2023-01-24 17:26:58 +02:00
|
|
|
SERVER_PUMP="false"
|
|
|
|
MOBILE_PUMP="false"
|
|
|
|
|
|
|
|
while getopts 's:m:' flag; do
|
|
|
|
case "${flag}" in
|
2023-02-02 08:53:22 +02:00
|
|
|
s) SERVER_PUMP=${OPTARG} ;;
|
|
|
|
m) MOBILE_PUMP=${OPTARG} ;;
|
|
|
|
*)
|
|
|
|
echo "Invalid args"
|
|
|
|
exit 1
|
|
|
|
;;
|
2023-01-24 17:26:58 +02:00
|
|
|
esac
|
|
|
|
done
|
2023-01-24 05:46:37 +02:00
|
|
|
|
2024-02-19 01:03:01 +02:00
|
|
|
CURRENT_SERVER=$(jq -r '.version' server/package.json)
|
|
|
|
MAJOR=$(echo "$CURRENT_SERVER" | cut -d '.' -f1)
|
|
|
|
MINOR=$(echo "$CURRENT_SERVER" | cut -d '.' -f2)
|
|
|
|
PATCH=$(echo "$CURRENT_SERVER" | cut -d '.' -f3)
|
2023-01-24 05:46:37 +02:00
|
|
|
|
|
|
|
if [[ $SERVER_PUMP == "major" ]]; then
|
|
|
|
MAJOR=$((MAJOR + 1))
|
2023-02-02 08:53:22 +02:00
|
|
|
MINOR=0
|
|
|
|
PATCH=0
|
2023-01-24 05:46:37 +02:00
|
|
|
elif [[ $SERVER_PUMP == "minor" ]]; then
|
|
|
|
MINOR=$((MINOR + 1))
|
2023-02-02 08:53:22 +02:00
|
|
|
PATCH=0
|
2023-01-24 17:26:58 +02:00
|
|
|
elif [[ $SERVER_PUMP == "patch" ]]; then
|
2023-01-24 05:46:37 +02:00
|
|
|
PATCH=$((PATCH + 1))
|
|
|
|
elif [[ $SERVER_PUMP == "false" ]]; then
|
|
|
|
echo 'Skipping Server Pump'
|
|
|
|
else
|
2023-01-24 17:26:58 +02:00
|
|
|
echo 'Expected <major|minor|patch|false> for the server argument'
|
2023-01-24 05:46:37 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
NEXT_SERVER=$MAJOR.$MINOR.$PATCH
|
|
|
|
|
2024-02-19 01:03:01 +02:00
|
|
|
CURRENT_MOBILE=$(grep "^version: .*+[0-9]\+$" mobile/pubspec.yaml | cut -d "+" -f2)
|
2023-01-24 05:46:37 +02:00
|
|
|
NEXT_MOBILE=$CURRENT_MOBILE
|
2023-01-24 17:26:58 +02:00
|
|
|
if [[ $MOBILE_PUMP == "true" ]]; then
|
2023-01-24 05:46:37 +02:00
|
|
|
set $((NEXT_MOBILE++))
|
|
|
|
elif [[ $MOBILE_PUMP == "false" ]]; then
|
|
|
|
echo 'Skipping Mobile Pump'
|
|
|
|
else
|
2023-01-24 17:26:58 +02:00
|
|
|
echo "Fatal: MOBILE_PUMP value $MOBILE_PUMP is invalid"
|
2023-01-24 05:46:37 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$CURRENT_SERVER" != "$NEXT_SERVER" ]; then
|
|
|
|
echo "Pumping Server: $CURRENT_SERVER => $NEXT_SERVER"
|
2024-02-19 01:03:01 +02:00
|
|
|
npm --prefix server version "$SERVER_PUMP"
|
2024-05-23 13:40:57 +02:00
|
|
|
npm --prefix server ci
|
|
|
|
npm --prefix server run build
|
2024-01-19 19:09:18 +02:00
|
|
|
make open-api
|
2024-03-03 23:17:21 +02:00
|
|
|
npm --prefix open-api/typescript-sdk version "$SERVER_PUMP"
|
2024-06-11 15:33:36 +02:00
|
|
|
# TODO use $SERVER_PUMP once we pass 2.2.x
|
|
|
|
npm --prefix cli version patch
|
|
|
|
npm --prefix cli i --package-lock-only
|
2024-03-03 23:17:21 +02:00
|
|
|
npm --prefix web version "$SERVER_PUMP"
|
|
|
|
npm --prefix web i --package-lock-only
|
2024-06-11 15:33:36 +02:00
|
|
|
npm --prefix e2e version "$SERVER_PUMP"
|
2024-03-03 23:17:21 +02:00
|
|
|
npm --prefix e2e i --package-lock-only
|
2024-02-19 01:03:01 +02:00
|
|
|
poetry --directory machine-learning version "$SERVER_PUMP"
|
2023-01-24 05:46:37 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$CURRENT_MOBILE" != "$NEXT_MOBILE" ]; then
|
|
|
|
echo "Pumping Mobile: $CURRENT_MOBILE => $NEXT_MOBILE"
|
|
|
|
fi
|
2023-01-24 17:26:58 +02:00
|
|
|
|
2023-02-16 17:13:42 +02:00
|
|
|
sed -i "s/\"android\.injected\.version\.name\" => \"$CURRENT_SERVER\",/\"android\.injected\.version\.name\" => \"$NEXT_SERVER\",/" mobile/android/fastlane/Fastfile
|
|
|
|
sed -i "s/version_number: \"$CURRENT_SERVER\"$/version_number: \"$NEXT_SERVER\"/" mobile/ios/fastlane/Fastfile
|
|
|
|
sed -i "s/\"android\.injected\.version\.code\" => $CURRENT_MOBILE,/\"android\.injected\.version\.code\" => $NEXT_MOBILE,/" mobile/android/fastlane/Fastfile
|
|
|
|
sed -i "s/^version: $CURRENT_SERVER+$CURRENT_MOBILE$/version: $NEXT_SERVER+$NEXT_MOBILE/" mobile/pubspec.yaml
|
|
|
|
|
2024-06-11 11:33:45 +02:00
|
|
|
./misc/release/archive-version.js "$NEXT_SERVER"
|
|
|
|
|
2024-02-19 01:03:01 +02:00
|
|
|
echo "IMMICH_VERSION=v$NEXT_SERVER" >>"$GITHUB_ENV"
|