This repository was archived by the owner on Jun 6, 2023. It is now read-only.
Repository navigation
77 lines (66 loc) · 2.79 KB
/
Copy pathappengine-deploy.yml
File metadata and controls
77 lines (66 loc) · 2.79 KB
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
name: Deploy to App Engine
on:
push:
branches:
- main
pull_request:
# The golden hash represents the commit of the baseline images that we want to
# compare our current app against. It is automatically set as the most recent
# commit to main.
env:
APPENGINE_VERSION_PREFIX: invalid
SHA_SHORT: invalid
CURRENT_HASH: invalid
GOLDEN_HASH: invalid
jobs:
appengine-deploy:
name: Deploy to App Engine
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v2
- name: Set env variables for the push to main
if: github.ref == 'refs/heads/main'
run: |
echo "::set-env name=APPENGINE_VERSION_PREFIX::main"
echo "::set-env name=SHA_SHORT::$(git rev-parse --short=7 ${{ github.sha }})"
echo "::set-env name=CURRENT_HASH::${{ github.sha }}"
- name: Set env variables for the pull request
if: github.ref != 'refs/heads/main'
run: |
echo "::set-env name=APPENGINE_VERSION_PREFIX::pr${{ github.event.pull_request.number }}"
echo "::set-env name=SHA_SHORT::$(git rev-parse --short=7 ${{ github.event.pull_request.head.sha }})"
echo "::set-env name=CURRENT_HASH::${{ github.event.pull_request.head.sha }}"
- name: Set golden hash
run: |
echo "::set-env name=GOLDEN_HASH::$(git ls-remote git://github.com/googleinterns/step189-2020.git refs/heads/main | cut -f 1)"
- name: Build
working-directory: web
run: |
npm ci
npm run genproto
npm run build
# Use Google Cloud credentials to deploy an App Engine Application:
# https://github.com/GoogleCloudPlatform/github-actions/tree/master/appengine-deploy
- id: deploy
name: Deploy to App Engine
uses: GoogleCloudPlatform/github-actions/appengine-deploy@master
with:
credentials: ${{ secrets.APPENGINE_SA_KEY_B64 }}
project_id: ${{ secrets.PROJECT_ID }}
deliverables: ${{ github.workspace }}/web/app.yaml
version: ${{ env.APPENGINE_VERSION_PREFIX }}-${{ env.SHA_SHORT }}
promote: false
- id: test
name: Test the deloyed URL
run: curl --fail "${{ steps.deploy.outputs.url }}"
- name: Test screenshots using Happo
working-directory: web
run: npm run happo-ci-github-actions
env:
PREVIOUS_SHA: ${{ env.GOLDEN_HASH }}
CURRENT_SHA: ${{ env.CURRENT_HASH }}
CHANGE_URL: https://github.com/googleinterns/step189-2020/commit/${{ env.CURRENT_HASH }}
HAPPO_API_KEY: ${{ secrets.HAPPO_API_KEY }}
HAPPO_API_SECRET: ${{ secrets.HAPPO_API_TOKEN }}
URL: https://${{ env.APPENGINE_VERSION_PREFIX }}-${{ env.SHA_SHORT }}-dot-step189-2020.uc.r.appspot.com/