Merge remote-tracking branch 'origin/appConfig' into appConfig

This commit is contained in:
julian 2024-05-21 15:43:22 -06:00
commit 6619940c93
2 changed files with 53 additions and 0 deletions

View file

@ -10,7 +10,10 @@ export ORIGINAL_APP_ID="com.cypherstack.stackwallet"
export NEW_NAME="Stack Duo"
export NEW_APP_ID="com.cypherstack.stackduo"
export NEW_VERSION="2.0.0"
export NEW_BUILD="" # Will increment existing build # if empty.
# String replacements.
if [[ "$(uname)" == 'Darwin' ]]; then
# macos specific sed
sed -i '' 's/Wallet/Duo/g' ../../lib/app_config.dart
@ -22,3 +25,6 @@ fi
# Extract Duo images.
unzip -o stack_duo_assets.zip -d ../../
# Update version & build number.
./update_version.sh -v "${NEW_VERSION}" -b "${NEW_BUILD}"

View file

@ -0,0 +1,47 @@
#!/bin/bash
# Function to display usage.
usage() {
echo "Usage: $0 [-v <version>] [-b <build_number>]"
exit 1
}
# Parse command-line arguments.
while getopts "v:b:" opt; do
case "$opt" in
v) VERSION="$OPTARG" ;;
b) BUILD_NUMBER="$OPTARG" ;;
*) usage ;;
esac
done
# Define the pubspec.yaml file path.
PUBSPEC_FILE="../../pubspec.yaml"
# Ensure the pubspec.yaml file exists.
if [ ! -f "$PUBSPEC_FILE" ]; then
echo "Error: $PUBSPEC_FILE not found!"
exit 1
fi
# Extract the current version and build number from pubspec.yaml.
CURRENT_VERSION_LINE=$(grep "^version:" "$PUBSPEC_FILE")
CURRENT_VERSION=$(echo "$CURRENT_VERSION_LINE" | cut -d ' ' -f 2)
CURRENT_VERSION_NUMBER=$(echo "$CURRENT_VERSION" | cut -d '+' -f 1)
CURRENT_BUILD_NUMBER=$(echo "$CURRENT_VERSION" | cut -d '+' -f 2)
# If version is not provided, use the current version number.
if [ -z "$VERSION" ]; then
VERSION="$CURRENT_VERSION_NUMBER"
fi
# If build number is not provided or is empty, increment the current build number by one.
if [ -z "$BUILD_NUMBER" ]; then
BUILD_NUMBER=$((CURRENT_BUILD_NUMBER + 1))
fi
# Update the version and build number in pubspec.yaml.
TMP_FILE=$(mktemp)
sed "s/^version: .*/version: $VERSION+$BUILD_NUMBER/" "$PUBSPEC_FILE" > "$TMP_FILE" && mv "$TMP_FILE" "$PUBSPEC_FILE"
echo "Updated $PUBSPEC_FILE with version: $VERSION and build number: $BUILD_NUMBER"