-
Notifications
You must be signed in to change notification settings - Fork 32
/
ci.sh
52 lines (39 loc) · 907 Bytes
/
ci.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
#!/usr/bin/env bash
check() {
if [ "$1" != 0 ]
then
exit $1
fi
}
VERSION=`node -p -e "require('./package.json').version"`
VERSION_LATEST=`npm view mhy version`
echo version:${VERSION}
echo version_latest:${VERSION_LATEST}
if [ ${VERSION} = ${VERSION_LATEST} ]
then
exit 0
fi
# check swc config
echo "mhy config swc -f json --mhy-env=prod"
mhy config swc -f json --mhy-env=prod
check $?
echo "chmod 0777 -R ./"
chmod 0777 -R ./
check $?
npm pub
check $?
# Wait 2 minutes to make sure @latest is indeed the latest (npm caching is shit)
sleep 120
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
check $?
docker image rm mhy
docker build --no-cache -t mhy ./docker
check $?
docker tag mhy wintercounter/mhy:${VERSION}
check $?
docker push wintercounter/mhy:${VERSION}
check $?
docker tag mhy wintercounter/mhy:latest
check $?
docker push wintercounter/mhy:latest
check $?