Skip to content

Commit

Permalink
Update HyperTrack SDK iOS to 5.4.0 and Android to 7.4.0 (#25)
Browse files Browse the repository at this point in the history
Add SDK update automation.
  • Loading branch information
pavel-kuznetsov-hypertrack authored Feb 2, 2024
1 parent 963b01e commit ba7f39d
Show file tree
Hide file tree
Showing 8 changed files with 302 additions and 35 deletions.
61 changes: 36 additions & 25 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [2.1.0] - 2024-02-02

### Changed

- Updated HyperTrack SDK iOS to [5.4.0](https://github.com/hypertrack/sdk-ios/releases/tag/5.4.0)
- Updated HyperTrack SDK Android to [7.4.0](https://github.com/hypertrack/sdk-android/releases/tag/7.4.0)

## [2.0.1] - 2023-12-27

### Fixed
Expand Down Expand Up @@ -287,29 +296,31 @@ We are excited to announce the release of HyperTrack Cordova SDK 2.0.0, a major

- Cordova support for HyperTrack Android SDK v4.5.3

[2.0.0]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/2.0.0
[1.1.0]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/1.1.0
[1.0.3]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/1.0.3
[1.0.2]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/1.0.2
[1.0.1]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/1.0.1
[1.0.0]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/1.0.0
[0.6.4]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.6.4
[0.6.3]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.6.3
[0.6.2]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.6.2
[0.6.1]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.6.1
[0.6.0]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.6.0
[0.5.0]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.5.0
[0.4.2]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.4.2
[0.4.1]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.4.1
[0.4.0]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.4.0
[0.3.0]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.3.0
[0.2.1]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.2.1
[0.2.0]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.2.0
[0.1.1]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.1.1
[0.1.0]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.1.0
[0.0.6]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.0.6
[0.0.5]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.0.5
[0.0.4]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.0.4
[0.0.3]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.0.3
[0.0.2]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.0.2
[0.0.1]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.0.1
[0.0.2]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.0.2
[0.0.3]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.0.3
[0.0.4]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.0.4
[0.0.5]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.0.5
[0.0.6]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.0.6
[0.1.0]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.1.0
[0.1.1]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.1.1
[0.2.0]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.2.0
[0.2.1]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.2.1
[0.3.0]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.3.0
[0.4.0]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.4.0
[0.4.1]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.4.1
[0.4.2]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.4.2
[0.5.0]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.5.0
[0.6.0]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.6.0
[0.6.1]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.6.1
[0.6.2]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.6.2
[0.6.3]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.6.3
[0.6.4]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/0.6.4
[1.0.0]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/1.0.0
[1.0.1]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/1.0.1
[1.0.2]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/1.0.2
[1.0.3]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/1.0.3
[1.1.0]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/1.1.0
[2.0.0]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/2.0.0
[2.0.1]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/2.0.1
[2.1.0]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/tag/2.1.0
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

[![GitHub](https://img.shields.io/github/license/hypertrack/cordova-plugin-hypertrack?color=orange)](./LICENSE)
[![npm](https://img.shields.io/npm/v/cordova-plugin-hypertrack-v3.svg)](https://www.npmjs.com/package/cordova-plugin-hypertrack-v3)
[![iOS SDK](https://img.shields.io/badge/iOS%20SDK-5.0.7-brightgreen.svg)](https://github.com/hypertrack/sdk-ios)
[![Android SDK](https://img.shields.io/badge/Android%20SDK-7.0.9-brightgreen.svg)](https://github.com/hypertrack/sdk-android)
[![iOS SDK](https://img.shields.io/badge/iOS%20SDK-5.4.0-brightgreen.svg)](https://github.com/hypertrack/sdk-ios)
[![Android SDK](https://img.shields.io/badge/Android%20SDK-7.4.0-brightgreen.svg)](https://github.com/hypertrack/sdk-android)

[HyperTrack](https://www.hypertrack.com/) lets you add live location tracking to your mobile app. Live location is made available along with ongoing activity, tracking controls and tracking outage with reasons.

Expand Down
181 changes: 177 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,181 @@
alias b := build
alias c := clean
alias d := docs
alias gd := get-dependencies
alias od := open-docs
alias pt := push-tag
alias r := release
alias us := update-sdk
alias usa := update-sdk-android
alias usal := update-sdk-android-latest
alias usi := update-sdk-ios
alias usil := update-sdk-ios-latest
alias usl := update-sdk-latest
alias v := version

# Source: https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
# \ are escaped
SEMVER_REGEX := "(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?"

# MAKE SURE YOU HAVE
# #!/usr/bin/env sh
# set -e
# AT THE TOP OF YOUR RECIPE
_ask-confirm:
@bash -c 'read confirmation; if [[ $confirmation != "y" && $confirmation != "Y" ]]; then echo "Okay 😮‍💨 😅"; exit 1; fi'

build: get-dependencies hooks

clean: _clear-node-modules
rm package-lock.json

_clear-node-modules:
rm -rf node_modules

docs: hooks
# no doc generation for cordova for now

get-dependencies:
# no dependencies for cordova plugin

hooks:
chmod +x .githooks/pre-push
git config core.hooksPath .githooks

release: hooks
npm publish --dry-run
@echo "THIS IS DRY RUN. Check if everything is ok and then run 'npm publish'. Checklist:"
@echo "\t- check the release steps in CONTRIBUTING"
_latest-android:
@curl -s https://s3-us-west-2.amazonaws.com/m2.hypertrack.com/com/hypertrack/sdk-android/maven-metadata-sdk-android.xml | grep latest | grep -o -E '{{SEMVER_REGEX}}' | head -n 1

_latest-ios:
@curl -s https://cocoapods.org/pods/HyperTrack | grep -m 1 -o -E "HyperTrack <span>{{SEMVER_REGEX}}" | grep -o -E '{{SEMVER_REGEX}}' | head -n 1

open-docs: docs
open docs/index.html

push-tag:
#!/usr/bin/env sh
set -euo pipefail
if [ $(git symbolic-ref --short HEAD) = "master" ] ; then
VERSION=$(just version)
git tag $VERSION
git push origin $VERSION
else
echo "You are not on main branch"
fi
release publish="dry-run": build
#!/usr/bin/env sh
set -euo pipefail
./.githooks/pre-push
VERSION=$(just version)
if [ {{publish}} = "publish" ]; then
BRANCH=$(git branch --show-current)
if [ $BRANCH != "master" ]; then
echo "You must be on main branch to publish a new version (current branch: $BRANCH))"
exit 1
fi
echo "Are you sure you want to publish version $VERSION? (y/N)"
just _ask-confirm
npm publish
open "https://www.npmjs.com/package/cordova-plugin-hypertrack-v3/v/$VERSION"
open "https://github.com/hypertrack/cordova-plugin-hypertrack/releases/tag/$VERSION"
else
npm publish --dry-run
fi
setup: get-dependencies hooks

_update-readme-android android_version:
./scripts/update_file.sh README.md 'Android\%20SDK-.*-brightgreen.svg' 'Android%20SDK-{{android_version}}-brightgreen.svg'

_update-readme-ios ios_version:
./scripts/update_file.sh README.md 'iOS\%20SDK-.*-brightgreen.svg' 'iOS%20SDK-{{ios_version}}-brightgreen.svg'

update-sdk-latest wrapper_version commit="true" branch="true":
#!/usr/bin/env sh
set -euo pipefail
LATEST_IOS=$(just _latest-ios)
LATEST_ANDROID=$(just _latest-android)
just update-sdk {{wrapper_version}} $LATEST_IOS $LATEST_ANDROID {{commit}} {{branch}}
update-sdk-android-latest wrapper_version commit="true" branch="true":
#!/usr/bin/env sh
set -euo pipefail
LATEST_ANDROID=$(just _latest-android)
just update-sdk-android {{wrapper_version}} $LATEST_ANDROID {{commit}} {{branch}}
update-sdk-ios-latest wrapper_version commit="true" branch="true":
#!/usr/bin/env sh
set -euo pipefail
LATEST_IOS=$(just _latest-ios)
just update-sdk-ios {{wrapper_version}} $LATEST_IOS {{commit}} {{branch}}
update-sdk wrapper_version ios_version android_version commit="true" branch="true": build
#!/usr/bin/env sh
set -euo pipefail
if [ "{{branch}}" = "true" ] ; then
git checkout -b update-sdk-ios-{{ios_version}}-android-{{android_version}}
fi
just version
echo "New version is {{wrapper_version}}"
just _update-wrapper-version-file {{wrapper_version}}
./scripts/update_changelog.sh -w {{wrapper_version}} -i {{ios_version}} -a {{android_version}}
echo "Updating HyperTrack SDK iOS to {{ios_version}}"
just _update-sdk-ios-version-file {{ios_version}}
just _update-readme-ios {{ios_version}}
echo "Updating HyperTrack SDK Android to {{android_version}}"
just _update-sdk-android-version-file {{android_version}}
just _update-readme-android {{android_version}}
just docs
if [ "{{commit}}" = "true" ] ; then
git add .
git commit -m "Update HyperTrack SDK iOS to {{ios_version}} and Android to {{android_version}}"
fi
update-sdk-android wrapper_version android_version commit="true" branch="true": build
#!/usr/bin/env sh
set -euo pipefail
if [ "{{branch}}" = "true" ] ; then
git checkout -b update-sdk-android-{{android_version}}
fi
just version
echo "Updating HyperTrack SDK Android to {{android_version}} on {{wrapper_version}}"
just _update-wrapper-version-file {{wrapper_version}}
just _update-sdk-android-version-file {{android_version}}
just _update-readme-android {{android_version}}
./scripts/update_changelog.sh -w {{wrapper_version}} -a {{android_version}}
just docs
if [ "{{commit}}" = "true" ] ; then
git add .
git commit -m "Update HyperTrack SDK Android to {{android_version}}"
fi
update-sdk-ios wrapper_version ios_version commit="true" branch="true": build
#!/usr/bin/env sh
set -euo pipefail
if [ "{{branch}}" = "true" ] ; then
git checkout -b update-sdk-ios-{{ios_version}}
fi
just version
echo "Updating HyperTrack SDK iOS to {{ios_version}} on {{wrapper_version}}"
just _update-wrapper-version-file {{wrapper_version}}
just _update-sdk-ios-version-file {{ios_version}}
just _update-readme-ios {{ios_version}}
./scripts/update_changelog.sh -w {{wrapper_version}} -i {{ios_version}}
just docs
if [ "{{commit}}" = "true" ] ; then
git add .
git commit -m "Update HyperTrack SDK iOS to {{ios_version}}"
fi
_update-sdk-android-version-file android_version:
./scripts/update_file.sh src/android/HypertrackPlugin.gradle "HYPERTRACK_SDK_VERSION = '.*'" "HYPERTRACK_SDK_VERSION = '{{android_version}}'"

_update-sdk-ios-version-file ios_version:
./scripts/update_file.sh plugin.xml '\<pod name="HyperTrack" spec=".*"\/\>' '\<pod name="HyperTrack" spec="{{ios_version}}"\/\>'

_update-wrapper-version-file wrapper_version:
./scripts/update_file.sh package.json '"version": ".*"' '"version": "{{wrapper_version}}"'
./scripts/update_file.sh plugin.xml 'version=".*"\>' 'version="{{wrapper_version}}">'

version:
@cat package.json | grep version | head -n 1 | grep -o -E '{{SEMVER_REGEX}}'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.0.1",
"version": "2.1.0",
"name": "cordova-plugin-hypertrack-v3",
"cordova_name": "Cordova HyperTrack Plugin",
"description": "Cordova Plugin for native HyperTrack SDKs",
Expand Down
4 changes: 2 additions & 2 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin-hypertrack-v3"
version="2.0.1">
version="2.1.0">
<name>HyperTrackPlugin</name>
<description>Cordova HyperTrack Plugin is a wrapper around native iOS and Android SDKs that allows to integrate HyperTrack into Cordova apps.</description>
<license>MIT</license>
Expand Down Expand Up @@ -76,7 +76,7 @@
<source url="https://cdn.cocoapods.org/" />
</config>
<pods use-frameworks="true">
<pod name="HyperTrack" spec="5.0.7"/>
<pod name="HyperTrack" spec="5.4.0"/>
</pods>
</podspec>

Expand Down
60 changes: 60 additions & 0 deletions scripts/update_changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash
set -euo pipefail

while [ "$#" -gt 0 ]; do
case "$1" in
-w)
wrapper_version="$2"
shift 2
;;
-i)
ios_version="$2"
shift 2
;;
-a)
android_version="$2"
shift 2
;;
*)
echo "Usage: $0 [-w wrapper_version] [-i ios_version] [-a android_version]"
exit 1
;;
esac
done

changelog_file="CHANGELOG.md"

if [ ! -f "$changelog_file" ]; then
echo "Error: $changelog_file not found."
exit 1
fi

if [ -z "$wrapper_version" ]; then
echo "Error: wrapper_version is required."
exit 1
fi

date=$(date +%Y-%m-%d)

$(echo "[$wrapper_version]: https://github.com/hypertrack/cordova-plugin-hypertrack/releases/tag/$wrapper_version" >>$changelog_file)

sed -i '' -e "8 i\\
" $changelog_file
sed -i '' -e "8 i\\
## [$wrapper_version] - $date" $changelog_file
sed -i '' -e "9 i\\
" $changelog_file
sed -i '' -e "10 i\\
### Changed" $changelog_file
sed -i '' -e "11 i\\
" $changelog_file

if [ -n "$android_version" ]; then
sed -i '' -e "12 i\\
- Updated HyperTrack SDK Android to [$android_version](https://github.com/hypertrack/sdk-android/releases/tag/$android_version)" $changelog_file
fi

if [ -n "$ios_version" ]; then
sed -i '' -e "12 i\\
- Updated HyperTrack SDK iOS to [$ios_version](https://github.com/hypertrack/sdk-ios/releases/tag/$ios_version)" $changelog_file
fi
23 changes: 23 additions & 0 deletions scripts/update_file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
set -euo pipefail

# Check if params are provided
if [ $# -ne 3 ]; then
echo "Usage: $0 <file> <source_text> <new_text>"
exit 1
fi

file="$1"
source_text="$2"
new_text="$3"

if [ ! -f "$file" ]; then
echo "Error: $file not found."
exit 1
fi

cat $file | sed "s/$source_text/$new_text/" >tmp
cat tmp >$file
rm -f tmp

echo "Updated $source_text in $file to $new_text"
2 changes: 1 addition & 1 deletion src/android/HyperTrackPlugin.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ def ANDROID_FCM_VERSION = System.getenv('ANDROID_FCM_VERSION') ?: rootProject.ha
buildscript {

ext {
HYPERTRACK_SDK_VERSION = '7.0.8'
HYPERTRACK_SDK_VERSION = '7.4.0'
ANDROID_GRADLE_TOOLS_VERSION = System.getenv('ANDROID_GRADLE_TOOLS_VERSION') ?: rootProject.hasProperty('ANDROID_GRADLE_TOOLS_VERSION') ? rootProject.ext.ANDROID_GRADLE_TOOLS_VERSION : '3.5.3'
ANDROID_GOOGLE_SERVICES_VERSION = System.getenv('ANDROID_GOOGLE_SERVICES_VERSION') ?: rootProject.hasProperty('ANDROID_GOOGLE_SERVICES_VERSION') ? rootProject.ext.ANDROID_GOOGLE_SERVICES_VERSION : '4.3.3'
ext.gradleNumberVersion = ANDROID_GRADLE_TOOLS_VERSION.substring(0, ANDROID_GRADLE_TOOLS_VERSION.lastIndexOf(".")).toFloat()
Expand Down

0 comments on commit ba7f39d

Please sign in to comment.