Skip to content

Commit

Permalink
add build number updater script
Browse files Browse the repository at this point in the history
  • Loading branch information
djbe committed Jan 2, 2018
1 parent f4b8767 commit f0c9ace
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions AppwiseCore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Pod::Spec.new do |s|
:git => 'https://github.com/appwise-labs/AppwiseCore.git',
:tag => s.version
}
s.preserve_paths = ['Scripts/*']
s.default_subspec = 'Core', 'Behaviours', 'UI'

# core spec
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.

## [Master](https://github.com//AppwiseCore)

### New Features

* Added build number updater script (`Scripts/update_build_number.sh`).

## [0.7.0](https://github.com/appwise-labs/AppwiseCore/releases/tag/0.7.0)

### New Features
Expand Down
32 changes: 32 additions & 0 deletions Scripts/update_build_number.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

git rev-parse 2> /dev/null > /dev/null || { echo >&2 "Git repository required. Aborting build number update script."; exit 0; }

# Create version
count=`git log --oneline | wc -l | awk '{gsub(/^ +| +$/,"")} {print $0}'`
date=$(((`date "+%s"` - 1514764800) / (15 * 60)))
version="$count.$date"
echo "Build number is $version"

# Main app info.plist
filepath="${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}"
echo "Updating $filepath"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${version}" "${filepath}"

# Extensions info.plist
echo "Searching in '${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/*.app/Info.plist'"
for subplist in "${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}"/*.app/Info.plist; do
echo "Updating $subplist"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${version}" "${subplist}"
done

echo "Searching in '${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/PlugIns/*.appex/Info.plist'"
for subplist in "${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}"/PlugIns/*.appex/Info.plist; do
echo "Updating $subplist"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${version}" "${subplist}"
done

# Dsym info.plist
filepath="${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist"
echo "Updating dSYM at ${filepath}"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${version}" "${filepath}"

0 comments on commit f0c9ace

Please sign in to comment.