This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
64 lines (64 loc) · 1.75 KB
/
config.yml
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
version: 2.1
jobs:
test:
docker:
- image: cimg/go:1.13
steps:
- checkout
- attach_workspace:
at: ./
- run:
name: Test go packages
command: dev-scripts/run-go-tests
- run:
name: Verify golang formatting
command: dev-scripts/check-go-formatting
deploy:
docker:
- image: google/cloud-sdk:351.0.0-slim
environment:
GCLOUD_PROJECT: tinypilotkvm
GO_RUNTIME: go113
FUNCTION_NAME: EmailSignup
steps:
- checkout
- attach_workspace:
at: ./
- run:
name: Retrieve client secret from CircleCI
command: |
echo "${CLIENT_SECRET}" | \
base64 --decode > "${HOME}/client-secret.json"
- run:
name: Authenticate gcloud
command: |
gcloud auth activate-service-account \
--key-file "${HOME}/client-secret.json"
- run:
name: Configure gcloud project
command: gcloud config set project "${GCLOUD_PROJECT}"
- run:
name: Configure runtime environment variables
command: |
echo "EMAIL_OCTOPUS_API_KEY: '${EMAIL_OCTOPUS_API_KEY}'" >> .env.yaml && \
echo "EMAIL_OCTOPUS_LIST_ID: '${EMAIL_OCTOPUS_LIST_ID}'" >> .env.yaml
- run:
name: Deploy to GCP
command: |
gcloud functions deploy \
"${FUNCTION_NAME}" \
--runtime "${GO_RUNTIME}" \
--env-vars-file .env.yaml \
--trigger-http \
--allow-unauthenticated
workflows:
version: 2
test-deploy:
jobs:
- test
- deploy:
requires:
- test
filters:
branches:
only: master