-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (40 loc) · 1.33 KB
/
website.yaml
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
name: Build Website
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with:
node-version: "20.9"
cache: npm
cache-dependency-path: package-lock.json
- name: Install dependencies
run: npm i
- name: Build website
run: npm run build
- uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4
if: github.ref == 'refs/heads/main'
with:
aws-access-key-id: ${{ secrets.WEBSITE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.WEBSITE_AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
- name: Deploy
if: github.ref == 'refs/heads/main'
run: >-
aws s3 sync build s3://glasskube.dev/
--cache-control "max-age=60, public"
--acl=public-read
- name: Invalidate cache
if: github.ref == 'refs/heads/main'
run: >-
aws cloudfront create-invalidation
--distribution-id EQF3TRPHYDZTB
--invalidation-batch "Paths={Quantity='1' ,Items=['/*']},CallerReference=WEBSITE_$GITHUB_RUN_ID"