68 lines (64 loc) · 2.72 KB
/
deploy.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
name: Build & Deploy Eleventy
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install Global Dependencies
run: |
npm -g install @deptagency/octopus
- name: Install dependencies & build
run: |
npm ci
npm run build
- name: Configure AWS credentials from AWS account
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{secrets.AWS_ROLE}}
aws-region: eu-west-2
role-duration-seconds: 900
role-session-name: GitHub-Deploy
- name: Copy files to the live website with the AWS CLI
run: |
aws s3 sync ./_site s3://martinhicks.dev --cache-control 'max-age=31536000' --delete --acl=public-read --follow-symlinks --exclude '*' --include 'images/*' --include 'css/*'
aws s3 sync ./_site s3://martinhicks.dev --cache-control 'no-cache' --delete --acl=public-read --follow-symlinks --exclude 'images/*' --exclude 'css/*'
- name: Invalidate CloudFront
run: |
aws cloudfront create-invalidation --distribution-id ${{secrets.CLOUDFRONT_DISTRIBUTION_ID}} --paths "/*"
- name: Check for broken links
run: |
octopus http://martinhicks.dev.s3-website.eu-west-2.amazonaws.com --ignore-external --include-images --slack-webhook ${{secrets.SLACK_WEBHOOK_URL}}
- name: Audit URLs using Lighthouse
id: LightHouseAction
uses: treosh/lighthouse-ci-action@v9
with:
urls: |
https://martinhicks.dev
uploadArtifacts: false # save results as an action artifacts
configPath: ./lighthouserc.json
- name: Lighthouse Webhook
uses: slackapi/slack-github-action@v1.23.0
with:
# This data can be any valid JSON from a previous step in the GitHub Action
payload: |
{
"url": "martinhicks.dev",
"performance": "${{fromJson(steps.LightHouseAction.outputs.manifest)[2].summary.performance}}",
"best-practices": "${{fromJson(steps.LightHouseAction.outputs.manifest)[2].summary['best-practices']}}",
"seo": "${{fromJson(steps.LightHouseAction.outputs.manifest)[2].summary.seo}}",
"accessibility": "${{fromJson(steps.LightHouseAction.outputs.manifest)[2].summary.accessibility}}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_LIGHTHOUSE_WEBHOOK_URL }}
- name: Debug
run: |
echo ${{steps.LightHouseAction.outputs.manifest}}