@@ -3,9 +3,9 @@ name: deploy-appengine Integration
3
3
on : [push, pull_request]
4
4
5
5
jobs :
6
- gcloud :
6
+ working-directory :
7
7
if : ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
8
- name : with setup-gcloud
8
+ name : with working directory
9
9
runs-on : ubuntu-latest
10
10
steps :
11
11
- uses : actions/checkout@v2
@@ -16,12 +16,13 @@ jobs:
16
16
export_default_credentials : true
17
17
- name : create app
18
18
run : |-
19
- cat <<EOF > ${{ github.workspace }}/app.yaml
19
+ mkdir app
20
+ cat <<EOF > ${{ github.workspace }}/app/app.yaml
20
21
service: "${{ github.job }}-${{ github.run_number }}"
21
22
runtime: "nodejs10"
22
23
EOF
23
24
24
- cat <<EOF > ${{ github.workspace }}/server.js
25
+ cat <<EOF > ${{ github.workspace }}/app/ server.js
25
26
const http = require('http');
26
27
const server = http.createServer(function (req, res) {
27
28
res.writeHead(200)
44
45
uses : ./
45
46
with :
46
47
project_id : ${{ secrets.APPENGINE_DEPLOY_PROJECT_ID }}
47
- deliverables : ${{ github.workspace }}/app.yaml
48
- version : gcloud
48
+ working_directory : app/
49
49
promote : false
50
50
- name : Test Output
51
51
run : |-
@@ -58,22 +58,29 @@ jobs:
58
58
--retry-delay 5 \
59
59
--retry-max-time 300
60
60
- name : Clean Up
61
+ if : ${{ always() }}
61
62
run : gcloud app services delete "${{ github.job }}-${{ github.run_number }}" --quiet
62
63
63
- b64-json :
64
+ deliverable :
64
65
if : ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
65
- name : with base64 json creds
66
+ name : with deliverable path
66
67
runs-on : ubuntu-latest
67
68
steps :
68
69
- uses : actions/checkout@v2
70
+ - uses : google-github-actions/setup-gcloud@master
71
+ with :
72
+ project_id : ${{ secrets.APPENGINE_DEPLOY_PROJECT_ID }}
73
+ service_account_key : ${{ secrets.APPENGINE_DEPLOY_SA_KEY_JSON }}
74
+ export_default_credentials : true
69
75
- name : create app
70
76
run : |-
71
- cat <<EOF > ${{ github.workspace }}/app.yaml
77
+ mkdir app
78
+ cat <<EOF > ${{ github.workspace }}/app/app.yaml
72
79
service: "${{ github.job }}-${{ github.run_number }}"
73
80
runtime: "nodejs10"
74
81
EOF
75
82
76
- cat <<EOF > ${{ github.workspace }}/server.js
83
+ cat <<EOF > ${{ github.workspace }}/app/ server.js
77
84
const http = require('http');
78
85
const server = http.createServer(function (req, res) {
79
86
res.writeHead(200)
@@ -95,10 +102,9 @@ jobs:
95
102
name : Deploy to App Engine
96
103
uses : ./
97
104
with :
98
- credentials : ${{ secrets.APPENGINE_DEPLOY_SA_KEY_B64 }}
99
- deliverables : ${{ github.workspace }}/app.yaml
100
- version : b64-json
101
- promote : false # Allows for deletion
105
+ project_id : ${{ secrets.APPENGINE_DEPLOY_PROJECT_ID }}
106
+ deliverables : app/app.yaml
107
+ promote : false
102
108
- name : Test Output
103
109
run : |-
104
110
curl '${{ steps.deploy.outputs.url }}' \
@@ -110,29 +116,20 @@ jobs:
110
116
--retry-delay 5 \
111
117
--retry-max-time 300
112
118
- name : Clean Up
119
+ if : ${{ always() }}
113
120
run : gcloud app services delete "${{ github.job }}-${{ github.run_number }}" --quiet
114
-
115
- json :
121
+
122
+ failure :
116
123
if : ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
117
- name : with json creds
124
+ name : with bad path
118
125
runs-on : ubuntu-latest
119
126
steps :
120
127
- 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
128
+ - uses : google-github-actions/setup-gcloud@master
129
+ with :
130
+ project_id : ${{ secrets.APPENGINE_DEPLOY_PROJECT_ID }}
131
+ service_account_key : ${{ secrets.APPENGINE_DEPLOY_SA_KEY_JSON }}
132
+ export_default_credentials : true
136
133
- name : Build dependency
137
134
working-directory : setupGcloudSDK
138
135
run : |-
@@ -143,23 +140,28 @@ jobs:
143
140
run : |-
144
141
npm install
145
142
npm run build
146
- - id : deploy
147
- name : Deploy to App Engine
143
+ - id : cwd
148
144
uses : ./
145
+ continue-on-error : true
149
146
with :
150
- credentials : ${{ secrets.APPENGINE_DEPLOY_SA_KEY_JSON }}
151
- deliverables : ${{ github.workspace }}/app.yaml
152
- version : json
153
- promote : false # Allows for deletion
154
- - name : Test Output
147
+ project_id : ${{ secrets.APPENGINE_DEPLOY_PROJECT_ID }}
148
+ working_directory : this/path/doesnt/exist/
149
+ promote : false
150
+ - name : Catch failure
155
151
run : |-
156
- curl '${{ steps.deploy.outputs.url }}' \
157
- --silent \
158
- --fail \
159
- --location \
160
- --retry 5 \
161
- --retry-connrefused \
162
- --retry-delay 5 \
163
- --retry-max-time 300
164
- - name : Clean Up
165
- run : gcloud app services delete "${{ github.job }}-${{ github.run_number }}" --quiet
152
+ if [ ${{ steps.cwd.outcome }} != 'failure' ]; then
153
+ exit 1
154
+ fi
155
+ - id : deliverable
156
+ uses : ./
157
+ continue-on-error : true
158
+ with :
159
+ project_id : ${{ secrets.APPENGINE_DEPLOY_PROJECT_ID }}
160
+ deliverables : this/path/doesnt/exist/app.yaml
161
+ promote : false
162
+ - name : Catch failure
163
+ run : |-
164
+ if [ ${{ steps.deliverable.outcome }} != 'failure' ]; then
165
+ exit 1
166
+ fi
167
+
0 commit comments