forked from vuestorefront/vue-storefront
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (80 loc) · 3.08 KB
/
deploy-lighthouse.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
name: Lighthouse Test
on:
push:
branches:
- lighthouse/next
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: "12.x"
- name: Build and publish docker image
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: demo-lighthouse-storefrontcloud-io/vue-storefront:${{ github.sha }}
registry: registry.storefrontcloud.io
username: ${{ secrets.CLOUD_USERNAME }}
password: ${{ secrets.CLOUD_PASSWORD }}
dockerfile: dev/docker/Dockerfile
buildoptions: "--compress"
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- uses: chrnorm/deployment-action@releases/v1
name: Create GitHub deployment
id: deployment
with:
token: "${{ github.token }}"
target_url: https://demo-lighthouse.europe-west1.gcp.storefrontcloud.io
environment: production
initial_status: in_progress
- name: Deploy on demo-lighthouse.europe-west1.gcp.storefrontcloud.io
if: github.ref == 'refs/heads/next'
run: |
if curl -s -H 'X-User-Id: ${{ secrets.DOCS_CLOUD_USERNAME }}' -H 'X-Api-Key: ${{ secrets.DOCS_CLOUD_PASSWORD }}' -H 'Content-Type: application/json' -X POST -d '{
"code":"demo-lighthouse",
"region":"europe-west1.gcp",
"frontContainerVersion":"${{ github.sha }}"
}' https://farmer.storefrontcloud.io/instances | grep -q '{"code":200,"result":"Instance updated!"}'; then
echo "Instance updated"
else
echo "Something went wrong during the update process..."
exit 1
fi
- name: Update deployment status (success)
if: success()
uses: chrnorm/deployment-status@releases/v1
with:
token: "${{ github.token }}"
target_url: https://demo-lighthouse.europe-west1.gcp.storefrontcloud.io
state: "success"
description: Congratulations! The deploy is done.
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
- name: Update deployment status (failure)
if: failure()
uses: chrnorm/deployment-status@releases/v1
with:
token: "${{ github.token }}"
target_url: https://demo-lighthouse.europe-west1.gcp.storefrontcloud.io
description: Unfortunately, the instance hasn't been updated.
state: "failure"
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
lighthouse:
runs-on: ubuntu-latest
needs: deploy
steps:
- uses: actions/checkout@v2
- name: Audit URLs using Lighthouse
uses: treosh/lighthouse-ci-action@v7
with:
urls: |
https://demo-lighthouse.europe-west1.gcp.storefrontcloud.io
# budgetPath: ./budget.json # test performance budgets
uploadArtifacts: true # save results as an action artifacts
temporaryPublicStorage: true # upload lighth