-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudbuild.yaml
95 lines (85 loc) · 2.6 KB
/
cloudbuild.yaml
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
options:
substitution_option: 'ALLOW_LOOSE'
steps:
- id: Decrypt the file containing the key
name: gcr.io/cloud-builders/gcloud
args:
- kms
- decrypt
- --ciphertext-file=gdgcloudtaipei_ida_rsa.enc
- --plaintext-file=/root/.ssh/gdgcloudtaipei_ida_rsa
- --location=global
- --keyring=taipei_gdgcloud_tw
- --key=github-key
volumes:
- name: ssh
path: /root/.ssh
- id: Set up git with key and domain
name: gcr.io/cloud-builders/git
entrypoint: bash
args:
- -exc
- |
chmod 600 /root/.ssh/gdgcloudtaipei_ida_rsa
cat <<EOF >/root/.ssh/config
Hostname github.com
IdentityFile /root/.ssh/gdgcloudtaipei_ida_rsa
EOF
ssh-keyscan -t rsa github.com >> /root/.ssh/known_hosts
volumes:
- name: ssh
path: /root/.ssh
- id: clone gcpugtaipei.github.io
name: gcr.io/cloud-builders/git
entrypoint: bash
args:
- -exc
- |
git clone [email protected]:gdgcloud-taipei/gdgcloudtaipei.github.io.git public
volumes:
- name: ssh
path: /root/.ssh
- id: build gcpugtaipei-website
name: monachus/hugo:v0.53
args:
- hugo
- id: make sure taipei.gdgcloud.tw CNAME
name: gcr.io/cloud-builders/docker
args:
- run
- busybox
- printf
- taipei.gdgcloud.tw > public/CNAME
- id: update alogolia
name: gcr.io/gcp-taiwan/gcpugtaipei-webiste-algolia
secretEnv:
- ALGOLIA_API_KEY
- id: analyse
name: gcr.io/gcp-taiwan/gcpugtaipei-webiste-analyse
env:
- ORIG_JSON=/workspace/public/algolia.json
- FORMATED_JSON=/workspace/public/blog_list.json
- TRANSLATORS=/workspace/content/translators.md
- AUTHORS=/workspace/content/authors.md
- id: rebuild gcpugtaipei-website for translators & authors
name: monachus/hugo:v0.53
args:
- hugo
- id: publish html to gcpugtaipei.github.io
name: gcr.io/cloud-builders/gcloud
entrypoint: bash
args:
- -exc
- |
cd /workspace/public
git config user.email $(gcloud auth list --filter=status:ACTIVE --format='value(account)')
git add .
git commit -m "auto build by $PROJECT_ID cloud build"
git push origin master
volumes:
- name: ssh
path: /root/.ssh
secrets:
- kmsKeyName: projects/gcp-taiwan/locations/global/keyRings/taipei_gdgcloud_tw/cryptoKeys/algolia
secretEnv:
ALGOLIA_API_KEY: CiQAPufRZmriTKXap0BRc9kdAtlT4/qKid8rWZ9aXPo/Yx63gCgSSQAl0LlBDpy0a5yzj+zaO3ICts+VFZzjlzUYa9sxFb68RfYZkkOQJRGcs1EmSJWsBI3OfdYruKI6FzpPUcNq3FI48gY/zBBgFQ0=