File tree 4 files changed +64
-0
lines changed
4 files changed +64
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ NOW_DOMAIN=$PROD_DOMAIN NOW_TOKEN=$NOW_TOKEN ./deploy.sh
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ NOW_DOMAIN=$DEV_DOMAIN NOW_TOKEN=$NOW_TOKEN ./deploy.sh
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Deploy the site using now and docker
4
+ if [ -n " $NOW_DOMAIN " ]
5
+ then
6
+
7
+ echo " Deploying " $NOW_DOMAIN
8
+ DEPLOY=$( now --token=$NOW_TOKEN -n $NOW_DOMAIN )
9
+ echo " "
10
+
11
+ else
12
+ echo " You did not supply a domain as NOW_DOMAIN"
13
+ exit
14
+
15
+ fi
16
+
17
+ # Find the ID
18
+ if [ -n " $DEPLOY " ]
19
+ then
20
+
21
+ CURRENTID=$( now --token=$NOW_TOKEN ls $NOW_DOMAIN | awk ' /.*([A-Za-z0-9]{24}).*/ { print $1; }' | head -n 1 )
22
+ else
23
+
24
+ echo " Deployment did not occur. Something is wrong."
25
+ exit
26
+
27
+ fi
28
+
29
+ # Alias the site and remove old aliases
30
+ if [ -n " $CURRENTID " ]
31
+ then
32
+
33
+ echo " Aliasing $CURRENTID to $NOW_DOMAIN "
34
+ NEWALIAS=$( now alias --token=$NOW_TOKEN $CURRENTID $NOW_DOMAIN )
35
+
36
+ if [ -n " $NEWALIAS " ]
37
+ then
38
+
39
+ echo " Alias succesful."
40
+ echo " Testing for old aliases"
41
+ OLDALIAS=$( now alias ls --token=$NOW_TOKEN | grep " https://$NOW_DOMAIN " | awk ' /now\.sh/ { print $2}' )
42
+
43
+ if [ -n " $OLDALIAS " ]
44
+ then
45
+
46
+ echo " $NOW_DOMAIN used to be aliased to $OLDALIAS , we should remove that."
47
+ echo " Removing old aliases..."
48
+ now --token=$NOW_TOKEN ls $NOW_DOMAIN | grep -v " $CURRENTID " | awk ' /.*([A-Za-z0-9]{24}).*/ { print $1; }' | xargs -I{} now --token=$NOW_TOKEN -y rm {}
49
+
50
+ fi
51
+ else
52
+ echo " We can not find a current alias."
53
+ fi
54
+ else
55
+ echo " We cannot find a current ID."
56
+ fi
Original file line number Diff line number Diff line change
1
+ {
2
+ "type" :" docker" ,
3
+ "alias" :" dev.optimized.technology"
4
+ }
You can’t perform that action at this time.
0 commit comments