-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·38 lines (29 loc) · 931 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
set -e # Exit on error
WIDGET_NAME=calendarfeed
# The root of the widget's source directory
base_dir=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
cd $base_dir
# Pull version from VERSION file
widget_version=`head -n 1 VERSION`
zipfile_name="$WIDGET_NAME-$widget_version.zip"
temp_dir=`mktemp -d /tmp/calendarfeed.XXXXXX`
build_dir="$temp_dir/$WIDGET_NAME/"
echo "Building $WIDGET_NAME version: $widget_version"
echo
echo "Rebuilding bundles from src-bundles..."
src-bundles/build.sh
echo
echo "Building widget zip archive ($zipfile_name)..."
# Copy our resources into the build directory
mkdir $build_dir
cp -a VERSION bundles config.json images lib calendarfeed.html css \
javascript $build_dir
# Build the zip file from the copied files
pushd $temp_dir
zip -9 -r "$base_dir/$zipfile_name" $WIDGET_NAME
popd &>/dev/null
echo
echo "Written $zipfile_name"
#clean up the temporary directory
rm -r $temp_dir