-
Notifications
You must be signed in to change notification settings - Fork 510
166 lines (159 loc) · 4.54 KB
/
appengine-deploy-it.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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: appengine-deploy Integration
on:
push:
paths:
- 'appengine-deploy/**'
- '.github/workflows/appengine-deploy*'
- 'setupGcloudSDK/**'
jobs:
gcloud:
name: with setup-gcloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: google-github-actions/setup-gcloud@master
with:
service_account_key: ${{ secrets.APPENGINE_DEPLOY_SA_KEY_JSON }}
export_default_credentials: true
- name: create app
run: |-
cat <<EOF > ${{ github.workspace }}/app.yaml
service: "${{ github.job }}-${{ github.run_number }}"
runtime: "nodejs10"
EOF
cat <<EOF > ${{ github.workspace }}/server.js
const http = require('http');
const server = http.createServer(function (req, res) {
res.writeHead(200)
res.end('Hello world!');
});
server.listen(process.env.PORT || 8080);
EOF
- name: Build dependency
working-directory: setupGcloudSDK
run: |-
npm install
npm run build
- id: build
name: Build dist
working-directory: appengine-deploy
run: |-
npm install
npm run build
- id: deploy
name: Deploy to App Engine
uses: ./appengine-deploy
with:
project_id: ${{ secrets.APPENGINE_DEPLOY_PROJECT_ID }}
deliverables: ${{ github.workspace }}/app.yaml
version: gcloud
- name: Test Output
run: |-
curl '${{ steps.deploy.outputs.url }}' \
--silent \
--fail \
--location \
--retry 5 \
--retry-connrefused \
--retry-delay 5 \
--retry-max-time 300
b64-json:
name: with base64 json creds
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: create app
run: |-
cat <<EOF > ${{ github.workspace }}/app.yaml
service: "${{ github.job }}-${{ github.run_number }}"
runtime: "nodejs10"
EOF
cat <<EOF > ${{ github.workspace }}/server.js
const http = require('http');
const server = http.createServer(function (req, res) {
res.writeHead(200)
res.end('Hello world!');
});
server.listen(process.env.PORT || 8080);
EOF
- name: Build dependency
working-directory: setupGcloudSDK
run: |-
npm install
npm run build
- id: build
name: Build dist
working-directory: appengine-deploy
run: |-
npm install
npm run build
- id: deploy
name: Deploy to App Engine
uses: ./appengine-deploy
with:
credentials: ${{ secrets.APPENGINE_DEPLOY_SA_KEY_B64 }}
deliverables: ${{ github.workspace }}/app.yaml
version: b64-json
promote: false # Allows for deletion
- name: Test Output
run: |-
curl '${{ steps.deploy.outputs.url }}' \
--silent \
--fail \
--location \
--retry 5 \
--retry-connrefused \
--retry-delay 5 \
--retry-max-time 300
- name: Clean Up
run: gcloud app versions delete b64-json --quiet
json:
name: with json creds
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: create app
run: |-
cat <<EOF > ${{ github.workspace }}/app.yaml
service: "${{ github.job }}-${{ github.run_number }}"
runtime: "nodejs10"
EOF
cat <<EOF > ${{ github.workspace }}/server.js
const http = require('http');
const server = http.createServer(function (req, res) {
res.writeHead(200)
res.end('Hello world!');
});
server.listen(process.env.PORT || 8080);
EOF
- name: Build dependency
working-directory: setupGcloudSDK
run: |-
npm install
npm run build
- id: build
name: Build dist
working-directory: appengine-deploy
run: |-
npm install
npm run build
- id: deploy
name: Deploy to App Engine
uses: ./appengine-deploy
with:
credentials: ${{ secrets.APPENGINE_DEPLOY_SA_KEY_JSON }}
deliverables: ${{ github.workspace }}/app.yaml
version: json
promote: false # Allows for deletion
- name: Test Output
run: |-
curl '${{ steps.deploy.outputs.url }}' \
--silent \
--fail \
--location \
--retry 5 \
--retry-connrefused \
--retry-delay 5 \
--retry-max-time 300
- name: Clean Up
run: gcloud app versions delete json --quiet