Skip to content

Commit

Permalink
🚀 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mikemilla committed Aug 14, 2024
1 parent de6ab9c commit 2ea9087
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 34 deletions.
1 change: 0 additions & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ declare -a steps=(
"Run Tests:sh run_tests.sh"
"Build Demo App:sh build_demo_app.sh"
"Update Build Version:sh update_version.sh"
"Install Brew:sh install_homebrew.sh"
"Create Git Release:sh git_release.sh"
"Release Cocoapod:sh release_pod.sh"
)
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: courier_flutter
description: Inbox, Push Notifications and Preferences for Flutter
version: 2.4.1
version: 3.0.0
homepage: https://courier.com

environment:
Expand Down
27 changes: 0 additions & 27 deletions release.sh

This file was deleted.

4 changes: 1 addition & 3 deletions build.sh → scripts/build_demo_app.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/bin/bash

# Navigate to the example directory
cd example || { echo "Failed to navigate to the example directory. Please ensure the path is correct."; exit 1; }
cd ../example || { echo "Failed to navigate to the example directory. Please ensure the path is correct."; exit 1; }
echo "Navigated to the example directory."

sh ../dist.sh

# Build Android app bundle
echo "🤖 Building Android app bundle..."
flutter build appbundle
Expand Down
89 changes: 89 additions & 0 deletions scripts/git_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/bin/bash

# Change to the root directory
cd "$(dirname "$0")/.."

# Define ANSI color codes
ORANGE='\033[0;33m'
NC='\033[0m' # No Color

# Function to handle errors and exit
error_exit() {
echo -e "❌ Error: $1" >&2
exit 1
}

# Function to get the package version from pubspec.yaml
get_package_version() {
local version=$(yq .version pubspec.yaml | tr -d '"')
echo "$version"
}

# Function to get the current Git branch
get_current_branch() {
git rev-parse --abbrev-ref HEAD
}

# Function to run git status
run_git_status() {
git status
}

# Function to add all changes and commit with message including version
add_commit() {
local version="$1"
git add -A
git commit -m "🚀 $version"
}

# Function to merge the current branch into master
merge_into_master() {
local branch=$(get_current_branch)
git checkout master
git merge --no-ff "$branch"
git push origin master
git checkout "$branch"
}

# Function to install GitHub CLI if not already installed
install_gh_cli() {
if ! which gh >/dev/null 2>&1; then
echo -e "${ORANGE}⚠️ Installing GitHub CLI...${NC}"
brew install gh || error_exit "Failed to install GitHub CLI. Please install it manually and retry."
fi
}

# Function to create GitHub release
create_github_release() {
local version="$1"
echo -e "${ORANGE}⚠️ Creating GitHub release for version $version...${NC}\n"
gh release create "$version" --notes "Release for version $version"
echo "✅ GitHub release $version created\n"
}

# Main script execution
# Check if GitHub CLI is installed
install_gh_cli

# Get the package version from pubspec.yaml
current_version=$(get_package_version)
echo "Current version is $current_version"

# Ask for confirmation to merge into master with versioned commit
read -p "Merge into master and create release with commit: '🚀 $current_version'? (y/n): " confirmation

if [[ $confirmation == "y" || $confirmation == "Y" ]]; then
# Perform the Git operations
run_git_status
add_commit "$current_version"
merge_into_master

# Tag the new version
git tag "$current_version"
git push --tags

# Create the GitHub release
create_github_release "$current_version"
else
echo "Merge and release process canceled."
fi
35 changes: 33 additions & 2 deletions scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,36 @@
# Change to the root directory
cd ../example || exit

# Run tests
flutter test integration_test/client_tests.dart
# Function to run the tests with the selected device ID
run_tests() {
flutter test integration_test/client_tests.dart --device-id="$DEVICE_ID"
flutter test integration_test/shared_tests.dart --device-id="$DEVICE_ID"
}

# Function to prompt the user to select a device and run the tests
select_device_and_run_tests() {
# List available devices
echo "Listing available devices..."
flutter devices

# Prompt the user to enter the device ID
echo "Please enter the device ID to run the tests on:"
read -r DEVICE_ID

# Run the tests with the selected device ID
run_tests

# Ask the user if they want to rerun the tests
while true; do
echo "Do you want to rerun the tests or end the script? (r to rerun, e to exit):"
read -r REPLY
case $REPLY in
[Rr]* ) select_device_and_run_tests; break;;
[Ee]* ) echo "Exiting."; exit;;
* ) echo "Please answer 'r' to rerun or 'e' to exit.";;
esac
done
}

# Start the process
select_device_and_run_tests
3 changes: 3 additions & 0 deletions dist.sh → scripts/update_version.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

# Change to the root directory
cd "$(dirname "$0")/.."

# Define ANSI color codes
ORANGE='\033[0;33m'
NC='\033[0m' # No Color
Expand Down

0 comments on commit 2ea9087

Please sign in to comment.