This repository has been archived by the owner on Nov 28, 2024. It is now read-only.
forked from fabric8-ui/fabric8-planner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcico_build_deploy_npm.sh
executable file
·57 lines (45 loc) · 1.68 KB
/
cico_build_deploy_npm.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
51
52
53
54
55
56
57
#!/bin/bash
# Show command before executing
set -x
# Exit on error
set -e
for var in BUILD_NUMBER BUILD_URL JENKINS_URL GIT_BRANCH GH_TOKEN NPM_TOKEN; do
export $(grep ${var} jenkins-env | xargs)
done
export BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M:%S`+00:00
# We need to disable selinux for now, XXX
#/usr/sbin/setenforce 0
# Get all the deps in
yum -y install docker
yum clean all
service docker start
docker build -t fabric8-planner-builder -f Dockerfile.builder .
mkdir -p dist && docker run --detach=true --name=fabric8-planner-builder -e JENKINS_URL -e GIT_BRANCH -e "CI=true" -e GH_TOKEN -e NPM_TOKEN -t -v $(pwd)/dist:/dist:Z fabric8-planner-builder
# In order to run semantic-release we need a non detached HEAD, see https://github.com/semantic-release/semantic-release/issues/329
docker exec fabric8-planner-builder git checkout master
# Try to fix up the git repo so that npm publish can build the gitHead ref in to package.json
docker exec fabric8-planner-builder ./fix-git-repo.sh
# Build almigty-ui
docker exec fabric8-planner-builder npm install
## Build prod
docker exec fabric8-planner-builder npm run build:prod
## Exec unit tests
docker exec fabric8-planner-builder ./run_unit_tests.sh
## Exec functional tests
#docker exec fabric8-planner-builder ./run_functional_tests.sh
if [ $? -eq 0 ]; then
echo 'CICO: functional tests OK'
# Don't treat a publish failure as a build failure as this is confusing
set +e
# Publish to npm
docker exec fabric8-planner-builder npm run semantic-release
if [ $? -eq 0 ]; then
echo 'CICO: module pushed to npmjs.com'
exit 0
else
echo 'CICO: module push to npmjs.com failed'
exit 0
fi
else
echo 'CICO: functional tests FAIL'
fi