File tree Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # access key
4
+ AK=$1
5
+ # secret key
6
+ SK=$2
7
+ # mode (default is dev)
8
+ mode=$3
9
+
10
+ # checks
11
+ if [ -z " $AK " ];
12
+ then
13
+ echo " Invalid command"
14
+ echo " command syntax is-> sh script.sh <Access key> <secret key>"
15
+ exit
16
+ elif [ -z " $SK " ];
17
+ then
18
+ echo " Invalid command"
19
+ echo " syntax is-> sh script.sh <key> <secret>"
20
+ exit
21
+ elif [ ! -e " ./serverless.yml" ]
22
+ then
23
+ echo " Please create and configure the serverless.yml file"
24
+ echo " For quick setup, you can use the one from the repo itself"
25
+ exit
26
+ elif [ ! command -v serverless & > /dev/null ]
27
+ then
28
+ echo " serverless could not be found, please install it first"
29
+ exit
30
+ fi
31
+
32
+ if [ -z " $mode " ];
33
+ then
34
+ mode=" dev"
35
+ fi
36
+
37
+ # configure the credentials
38
+ serverless config credentials \
39
+ --provider aws \
40
+ --key $AK \
41
+ --secret $SK \
42
+ --profile beacon \
43
+ -o
44
+
45
+ if [ $? -ne 0 ]; then
46
+ echo " Couldn't update your credentials, please check the logs!"
47
+ echo " Trying serverless deploy..."
48
+ fi
49
+
50
+ # deploy to aws
51
+ serverless deploy \
52
+ --stage $mode \
53
+ --aws-profile beacon
54
+
55
+ if [ $? -ne 0 ]; then
56
+ echo " Error with serverless deploy, please check the logs!"
57
+ fi
58
+
59
+
60
+
61
+
62
+
63
+
You can’t perform that action at this time.
0 commit comments