-
Notifications
You must be signed in to change notification settings - Fork 2
77 lines (65 loc) · 3.14 KB
/
build.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
name: Build and deploy site
on: [ push ]
jobs:
build:
name: Build the site code
runs-on: ubuntu-latest
env:
GATSBY_TAGS_MODULES: ./site/plugins/gatsby-transformer-remark-tags/node_modules
GATSBY_PULLQUOTE_MODULES: ./site/plugins/gatsby-remark-transformer-pullquotes/node_modules
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Cache site node modules
id: cache-site-modules
uses: actions/cache@v3
with:
path: ./site/node_modules
key: site-build-${{hashFiles('**/site/package-lock.json')}}
restore-keys: site-build-${{hashFiles('**/site/package-lock.json')}}
- name: Install site deps
if: steps.cache-site-modules.outputs.cache-hit != 'true'
run: cd site && npm install
- name: Cache Tags plugin node modules
id: cache-tags-modules
uses: actions/cache@v3
with:
path: ${{env.GATSBY_TAGS_MODULES}}
key: site-tags-${{hashFiles('**/gatsby-transformer-remark-tags/package-lock.json')}}
restore-keys: site-tags-${{hashFiles('**/gatsby-transformer-remark-tags/package-lock.json')}}
- name: Install tags deps
if: steps.cache-tags-modules.outputs.cache-hit != 'true'
run: cd site/plugins/gatsby-transformer-remark-tags && npm install
- name: Cache pullquotes plugin node modules
id: cache-pullquotes-modules
uses: actions/cache@v3
with:
path: ${{env.GATSBY_PULLQUOTE_MODULES}}
key: site-tags-${{hashFiles('**/gatsby-remark-transformer-pullquotes/package-lock.json')}}
restore-keys: site-tags-${{hashFiles('**/gatsby-remark-transformer-pullquotes/package-lock.json')}}
- name: Install pullquote deps
if: steps.cache-pullquotes-modules.outputs.cache-hit != 'true'
run: cd site/plugins/gatsby-remark-transformer-pullquotes && npm install
- name: Public output cache
id: cache-build
uses: actions/cache@v3
with:
path: ./site/public
key: site-public-${{hashFiles('**/site/**')}}
restore-keys: site-public-${{hashFiles('**/site/**')}}
- name: Build output files
run: make build
- name: Configure AWS CLI
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-southeast-2
if: github.ref == 'refs/heads/master'
- name: Sync files to S3
run: aws s3 sync ./site/public/ s3://aj-web-ajfisher-me-prod/ --delete
if: github.ref == 'refs/heads/master'