-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·47 lines (42 loc) · 1.07 KB
/
deploy.sh
File metadata and controls
executable file
·47 lines (42 loc) · 1.07 KB
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
#!/bin/bash
set -eu
deploy_pub () {
(cd pub && go mod tidy)
gcloud --project="$1" functions deploy slack-gemini-pub \
--gen2 \
--runtime=go125 \
--region=asia-northeast1 \
--source=./pub \
--entry-point=Publish \
--trigger-http \
--allow-unauthenticated \
--env-vars-file=./.env.yaml \
--service-account="$2"
}
deploy_sub () {
(cd sub && go mod tidy)
gcloud --project="$1" functions deploy slack-gemini-sub \
--gen2 \
--runtime=go125 \
--region=asia-northeast1 \
--source=./sub \
--entry-point=Subscribe \
--trigger-topic=slack-gemini \
--env-vars-file=./.env.yaml \
--service-account="$2"
}
main () {
cd "$(dirname "$0")"
local project_id="$(yq -r '.PROJECT_ID' < .env.yaml)"
local service_account="$(yq -r '.SERVICE_ACCOUNT' < .env.yaml)"
[[ $# -lt 1 || "$1" = 'pub' ]] && {
echo -e 'Start deploying slack-gemini-pub function...\n'
deploy_pub "$project_id" "$service_account"
echo
}
[[ $# -lt 1 || "$1" = 'sub' ]] && {
echo -e 'Start deploying slack-gemini-sub function...\n'
deploy_sub "$project_id" "$service_account"
}
}
main "$@"