@@ -13,39 +13,31 @@ jobs:
1313 with :
1414 project_id : ${{ secrets.APPENGINE_DEPLOY_PROJECT_ID }}
1515 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+
3221 - name : Build dependency
3322 working-directory : setupGcloudSDK
3423 run : |-
3524 npm install
3625 npm run build
26+
3727 - id : build
3828 name : Build dist
3929 run : |-
4030 npm install
4131 npm run build
32+
4233 - id : deploy
4334 name : Deploy to App Engine
4435 uses : ./
4536 with :
46- project_id : ${{ secrets.APPENGINE_DEPLOY_PROJECT_ID }}
4737 version : gcloud
4838 promote : false
39+ working_directory : ${{ github.workspace }}/example-app/
40+
4941 - name : Test Output
5042 run : |-
5143 curl '${{ steps.deploy.outputs.url }}' \
@@ -56,31 +48,71 @@ jobs:
5648 --retry-connrefused \
5749 --retry-delay 5 \
5850 --retry-max-time 300
51+
5952 - name : Clean Up
6053 if : ${{ always() }}
6154 run : gcloud app services delete "${{ github.job }}-${{ github.run_number }}" --quiet
6255
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+
63106 b64-json :
64107 if : ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name }}
65108 name : with base64 json creds
66109 runs-on : ubuntu-latest
67110 steps :
68111 - 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+
84116 - name : Build dependency
85117 working-directory : setupGcloudSDK
86118 run : |-
@@ -91,13 +123,16 @@ jobs:
91123 run : |-
92124 npm install
93125 npm run build
126+
94127 - id : deploy
95128 name : Deploy to App Engine
96129 uses : ./
97130 with :
98131 credentials : ${{ secrets.APPENGINE_DEPLOY_SA_KEY_B64 }}
99132 version : b64-json
100133 promote : false # Allows for deletion
134+ working_directory : ${{ github.workspace }}/example-app/
135+
101136 - name : Test Output
102137 run : |-
103138 curl '${{ steps.deploy.outputs.url }}' \
@@ -118,21 +153,10 @@ jobs:
118153 runs-on : ubuntu-latest
119154 steps :
120155 - 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+
136160 - name : Build dependency
137161 working-directory : setupGcloudSDK
138162 run : |-
@@ -143,13 +167,16 @@ jobs:
143167 run : |-
144168 npm install
145169 npm run build
170+
146171 - id : deploy
147172 name : Deploy to App Engine
148173 uses : ./
149174 with :
150175 credentials : ${{ secrets.APPENGINE_DEPLOY_SA_KEY_JSON }}
151176 version : json
152177 promote : false # Allows for deletion
178+ working_directory : ${{ github.workspace }}/example-app/
179+
153180 - name : Test Output
154181 run : |-
155182 curl '${{ steps.deploy.outputs.url }}' \
@@ -160,6 +187,7 @@ jobs:
160187 --retry-connrefused \
161188 --retry-delay 5 \
162189 --retry-max-time 300
190+
163191 - name : Clean Up
164192 if : ${{ always() }}
165193 run : gcloud app services delete "${{ github.job }}-${{ github.run_number }}" --quiet
0 commit comments