-
Notifications
You must be signed in to change notification settings - Fork 14
/
entrypoint.sh
executable file
·65 lines (57 loc) · 1.53 KB
/
entrypoint.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
58
59
60
61
62
63
64
65
#!/bin/sh -l
CLASPRC=$(cat <<-END
{
"token": {
"access_token": "$1",
"refresh_token": "$3",
"scope": "https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/service.management https://www.googleapis.com/auth/script.deployments https://www.googleapis.com/auth/logging.read https://www.googleapis.com/auth/script.webapp.deploy https://www.googleapis.com/auth/userinfo.profile openid https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/script.projects https://www.googleapis.com/auth/drive.metadata.readonly",
"token_type": "Bearer",
"id_token": "$2"
},
"oauth2ClientSettings": {
"clientId": "$4",
"clientSecret": "$5",
"redirectUri": "http://localhost"
},
"isLocalCreds": false
}
END
)
echo $CLASPRC > ~/.clasprc.json
CLASP=$(cat <<-END
{
"scriptId": "$6"
}
END
)
if [ -n "$7" ]; then
if [ -e "$7" ]; then
cd "$7"
else
echo "rootDir is invalid."
exit 1
fi
fi
echo $CLASP > .clasp.json
if [ "$8" = "push" ]; then
clasp push -f
elif [ "$8" = "deploy" ]; then
if [ -n "$9" ]; then
clasp push -f
if [ -n "${10}" ]; then
clasp deploy --description $9 -i ${10}
else
clasp deploy --description $9
fi
else
clasp push -f
if [ -n "${10}" ]; then
clasp deploy -i ${10}
else
clasp deploy
fi
fi
else
echo "command is invalid."
exit 1
fi