-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.sh
executable file
·50 lines (34 loc) · 1.56 KB
/
publish.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
49
50
#!/bin/bash
GH_REF="`node -p -e "require('./package.json').repository.url.replace('https://', '')"`"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo "PUBLISH GH-PAGES :: START"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo "/***** INSTALL LIBRARY DEPENDENCIES ****/"
npm install || { echo 'INSTALL LIBRARY DEPENDENCIES: failed'; exit 1; }
echo "/***** LIBRARY DISTRIBUTION ****/"
npm run lib::dist || { echo 'LIBRARY DISTRIBUTION: failed'; exit 1; }
npm run lib::coverage || { echo 'LIBRARY COVERAGE: failed'; exit 1; }
echo "/***** ENTER APPLICATION DIRECTORY ****/"
cd app
echo "/***** INSTALL APPLICATION DEPENDENCIES ****/"
npm install || { echo 'INSTALL APPLICATION DEPENDENCIES: failed'; exit 1; }
echo "/***** APPLICATION DISTRIBUTION ****/"
npm run app::dist || { echo 'APPLICATION DISTRIBUTION: failed'; exit 1; }
echo "/***** LIBRARY LCOV >>> COVERALLS ****/"
cat ../coverage/lcov.info | ../node_modules/.bin/coveralls
echo "/***** ENTER APPLICATION DIST DIRECTORY ****/"
cd dist
echo "/***** CREATE TMP REPO TO PUBLISH ****/"
git init
git config user.name "Publisher Flow"
git config user.email "dario.civallero@gmail.com"
git add .
echo "/***** COMMIT VERSION ****/"
PUBLISH_TIME="`date +'%Y-%m-%d %H:%M:%S'`"
git commit -m "[$PUBLISH_TIME] Publish gh-pages"
git push --force --quiet "https://${GH_TOKEN}@$GH_REF" master:gh-pages > /dev/null 2>&1
echo "/***** CLEAN TMP REPO ****/"
rm -rf .git
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo "PUBLISH GH-PAGES :: END"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -