-
Notifications
You must be signed in to change notification settings - Fork 1
/
jenkins.sh
executable file
·48 lines (40 loc) · 1.84 KB
/
jenkins.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
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# VARS
REPOSITORY_NAME='generator-m-ionic-demo'
REPOSITORY_BASE='https://github.com/mwaylabs/'
# TODO: set BUILD variable
BUILD=0
echo -e '\n####################### CLONING #######################\n'
git clone ${REPOSITORY_BASE}${REPOSITORY_NAME}
cd ${REPOSITORY_NAME}
# install dependencies
echo -e '\n####################### INSTALL DEPENDENCIES #######################\n'
echo -e 'installing npm packages'
npm prune
npm install
echo -e 'installing bower packages'
bower prune
bower install
echo -e '\n####################### CONFIGURATION #######################\n'
# retrieve version from config.xml
VERSION="$(gulp config --silent --getWidgetAttr=version)"
# append the build number and save in config.xml
gulp config --setWidgetAttr="version=${VERSION}"
# set the android-versionCode
gulp config --setWidgetAttr="android-versionCode=${BUILD}"
gulp config --setWidgetAttr="android-versionName=${VERSION}.${BUILD}"
gulp config --silent --setWidgetAttr="ios-CFBundleVersion=${VERSION}.${BUILD}"
echo -e '\n####################### GULP BUILD #######################\n'
# run gulp build explicitly to make it more obvious what's happening
# build: inject version and build number into app
# build: with dev environment and minify
gulp build --buildVars="version:${VERSION},build:${BUILD}" --env=dev --minify
echo -e '\n####################### BUILDING IOS #######################\n'
# --no-build here so we can use the one we just built
# provide resources set1
gulp --cordova 'prepare ios' --no-build --res=set1
echo -e '\n######################## BUILDING ANDROID #######################\n'
# --no-build here so we can use the one we just built
# provide different resources set
gulp --cordova 'build android --release' --no-build --res=set2
echo -e '\n####################### DONE #######################\n'