-
Notifications
You must be signed in to change notification settings - Fork 4
70 lines (57 loc) · 1.59 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
name: Build and Deploy
on:
push:
branches: [ main ]
pull_request:
types: [opened, synchronize, reopened]
schedule:
- cron: '0 11 * * *'
workflow_dispatch:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
S3_BUCKET: "${{ secrets.S3_BUCKET }}"
CLOUDFRONT_ID: ${{ secrets.CLOUDFRONT_ID }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 19.x
uses: actions/setup-node@v3
with:
node-version: 19.x
cache: 'npm'
- uses: jongwooo/next-cache@v1
- run: npm ci
- run: npm run build
- name: Archive site as artifact
uses: actions/upload-artifact@v1
with:
name: out
path: out
- name: Archive s3_website.yml as artifact
uses: actions/upload-artifact@v1
with:
name: s3_website
path: s3_website.yml
deploy:
runs-on: ubuntu-latest
needs: build
if: contains(github.ref, 'main')
steps:
- name: Retrieve site from artifacts
uses: actions/download-artifact@v1
with:
name: out
- name: Retrieve s3_website.yml from artifacts
uses: actions/download-artifact@v1
with:
name: s3_website
- name: Move s3_website.yml into root
run: |
mv s3_website/s3_website.yml s3_website.yml
- name: S3 Publish
uses: docker://justinharringa/s3_website:master
with:
args: 'push --site out'