@@ -13,39 +13,31 @@ jobs:
13
13
with :
14
14
project_id : ${{ secrets.APPENGINE_DEPLOY_PROJECT_ID }}
15
15
service_account_key : ${{ secrets.APPENGINE_DEPLOY_SA_KEY_JSON }}
16
- export_default_credentials : true
17
- - name : create app
18
- run : |-
19
- cat <<EOF > ${{ github.workspace }}/app.yaml
20
- service: "${{ github.job }}-${{ github.run_number }}"
21
- runtime: "nodejs10"
22
- EOF
23
-
24
- cat <<EOF > ${{ github.workspace }}/server.js
25
- const http = require('http');
26
- const server = http.createServer(function (req, res) {
27
- res.writeHead(200)
28
- res.end('Hello world!');
29
- });
30
- server.listen(process.env.PORT || 8080);
31
- EOF
16
+
17
+ - name : Update app.yaml
18
+ run : |-
19
+ echo "service: ${{ github.job }}-${{ github.run_number }}" >> ${{ github.workspace }}/example-app/app.yaml
20
+
32
21
- name : Build dependency
33
22
working-directory : setupGcloudSDK
34
23
run : |-
35
24
npm install
36
25
npm run build
26
+
37
27
- id : build
38
28
name : Build dist
39
29
run : |-
40
30
npm install
41
31
npm run build
32
+
42
33
- id : deploy
43
34
name : Deploy to App Engine
44
35
uses : ./
45
36
with :
46
- project_id : ${{ secrets.APPENGINE_DEPLOY_PROJECT_ID }}
47
37
version : gcloud
48
38
promote : false
39
+ working_directory : ${{ github.workspace }}/example-app/
40
+
49
41
- name : Test Output
50
42
run : |-
51
43
curl '${{ steps.deploy.outputs.url }}' \
@@ -56,31 +48,71 @@ jobs:
56
48
--retry-connrefused \
57
49
--retry-delay 5 \
58
50
--retry-max-time 300
51
+
59
52
- name : Clean Up
60
53
if : ${{ always() }}
61
54
run : gcloud app services delete "${{ github.job }}-${{ github.run_number }}" --quiet
62
55
56
+ gcloud2 :
57
+ if : ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
58
+ name : with setup-gcloud - no project Id
59
+ runs-on : ubuntu-latest
60
+ steps :
61
+ - uses : actions/checkout@v2
62
+ - uses : google-github-actions/setup-gcloud@master
63
+ with :
64
+ service_account_key : ${{ secrets.APPENGINE_DEPLOY_SA_KEY_JSON }}
65
+
66
+ - name : Update app.yaml
67
+ run : |-
68
+ echo "service: ${{ github.job }}-${{ github.run_number }}" >> ${{ github.workspace }}/example-app/app.yaml
69
+
70
+ - name : Build dependency
71
+ working-directory : setupGcloudSDK
72
+ run : |-
73
+ npm install
74
+ npm run build
75
+
76
+ - id : build
77
+ name : Build dist
78
+ run : |-
79
+ npm install
80
+ npm run build
81
+
82
+ - id : deploy
83
+ name : Deploy to App Engine
84
+ uses : ./
85
+ with :
86
+ project_id : ${{ secrets.APPENGINE_DEPLOY_PROJECT_ID }}
87
+ version : gcloud
88
+ promote : false
89
+ working_directory : ${{ github.workspace }}/example-app/
90
+
91
+ - name : Test Output
92
+ run : |-
93
+ curl '${{ steps.deploy.outputs.url }}' \
94
+ --silent \
95
+ --fail \
96
+ --location \
97
+ --retry 5 \
98
+ --retry-connrefused \
99
+ --retry-delay 5 \
100
+ --retry-max-time 300
101
+
102
+ - name : Clean Up
103
+ if : ${{ always() }}
104
+ run : gcloud app services delete "${{ github.job }}-${{ github.run_number }}" --quiet --project ${{ secrets.APPENGINE_DEPLOY_PROJECT_ID }}
105
+
63
106
b64-json :
64
107
if : ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
65
108
name : with base64 json creds
66
109
runs-on : ubuntu-latest
67
110
steps :
68
111
- uses : actions/checkout@v2
69
- - name : create app
70
- run : |-
71
- cat <<EOF > ${{ github.workspace }}/app.yaml
72
- service: "${{ github.job }}-${{ github.run_number }}"
73
- runtime: "nodejs10"
74
- EOF
75
-
76
- cat <<EOF > ${{ github.workspace }}/server.js
77
- const http = require('http');
78
- const server = http.createServer(function (req, res) {
79
- res.writeHead(200)
80
- res.end('Hello world!');
81
- });
82
- server.listen(process.env.PORT || 8080);
83
- EOF
112
+ - name : Update app.yaml
113
+ run : |-
114
+ echo "service: ${{ github.job }}-${{ github.run_number }}" >> ${{ github.workspace }}/example-app/app.yaml
115
+
84
116
- name : Build dependency
85
117
working-directory : setupGcloudSDK
86
118
run : |-
@@ -91,13 +123,16 @@ jobs:
91
123
run : |-
92
124
npm install
93
125
npm run build
126
+
94
127
- id : deploy
95
128
name : Deploy to App Engine
96
129
uses : ./
97
130
with :
98
131
credentials : ${{ secrets.APPENGINE_DEPLOY_SA_KEY_B64 }}
99
132
version : b64-json
100
133
promote : false # Allows for deletion
134
+ working_directory : ${{ github.workspace }}/example-app/
135
+
101
136
- name : Test Output
102
137
run : |-
103
138
curl '${{ steps.deploy.outputs.url }}' \
@@ -118,21 +153,10 @@ jobs:
118
153
runs-on : ubuntu-latest
119
154
steps :
120
155
- uses : actions/checkout@v2
121
- - name : create app
122
- run : |-
123
- cat <<EOF > ${{ github.workspace }}/app.yaml
124
- service: "${{ github.job }}-${{ github.run_number }}"
125
- runtime: "nodejs10"
126
- EOF
127
-
128
- cat <<EOF > ${{ github.workspace }}/server.js
129
- const http = require('http');
130
- const server = http.createServer(function (req, res) {
131
- res.writeHead(200)
132
- res.end('Hello world!');
133
- });
134
- server.listen(process.env.PORT || 8080);
135
- EOF
156
+ - name : Update app.yaml
157
+ run : |-
158
+ echo "service: ${{ github.job }}-${{ github.run_number }}" >> ${{ github.workspace }}/example-app/app.yaml
159
+
136
160
- name : Build dependency
137
161
working-directory : setupGcloudSDK
138
162
run : |-
@@ -143,13 +167,16 @@ jobs:
143
167
run : |-
144
168
npm install
145
169
npm run build
170
+
146
171
- id : deploy
147
172
name : Deploy to App Engine
148
173
uses : ./
149
174
with :
150
175
credentials : ${{ secrets.APPENGINE_DEPLOY_SA_KEY_JSON }}
151
176
version : json
152
177
promote : false # Allows for deletion
178
+ working_directory : ${{ github.workspace }}/example-app/
179
+
153
180
- name : Test Output
154
181
run : |-
155
182
curl '${{ steps.deploy.outputs.url }}' \
@@ -160,6 +187,7 @@ jobs:
160
187
--retry-connrefused \
161
188
--retry-delay 5 \
162
189
--retry-max-time 300
190
+
163
191
- name : Clean Up
164
192
if : ${{ always() }}
165
193
run : gcloud app services delete "${{ github.job }}-${{ github.run_number }}" --quiet
0 commit comments