-
Notifications
You must be signed in to change notification settings - Fork 51
41 lines (34 loc) · 1.26 KB
/
main.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
name: Build and deploy
on:
push:
branches:
- master
- beta
jobs:
build-and-deploy:
name: Build and deploy
runs-on: [ubuntu-latest]
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "us-west-2"
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v1
with:
node-version: 10.x
- name: Install dependencies and generate static site
run: |
npm install
npm run generate
- name: Install AWS CLI
run: pip install --user awscli
- name: Deploy site to AWS S3
run: |
aws s3 sync ./dist s3://www.gotodevops.org --delete --acl public-read --exclude "*.js"
aws s3 sync ./dist s3://www.gotodevops.org --delete --acl public-read --cache-control max-age=31536000,public --include "*.js"
- name: Invalidate CloudFront cache
run: |
aws configure set preview.cloudfront true
aws cloudfront create-invalidation --distribution-id ${{ secrets.WWW_CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*"
aws cloudfront create-invalidation --distribution-id ${{ secrets.NON_WWW_CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*"