-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (66 loc) · 2.02 KB
/
deploy.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
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
name: deploy
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
id-token: write
concurrency:
group: "deploy"
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.81.0
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://GitHub.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
# - name: Install Node.js dependencies
# run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Build with Hugo
env:
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--minify \
- name: Upload a Build Artifact
uses: actions/[email protected]
with:
name: hugo-site
path: ./public
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifacts (Docker images) from previous workflows
uses: actions/download-artifact@v4
with:
name: hugo-site
path: ./public
- name: "Configure AWS Credentials"
uses: aws-actions/[email protected]
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::867712374939:role/github-actions-ianferguson.io
role-session-name: GithubActions-Deployer
mask-aws-account-id: true
- name: Sync to S3
id: deployment
run: aws s3 sync ./public/ s3://ianferguson.io --size-only --delete --cache-control max-age=31536000
- name: Cloudfront Invalidation
id: flushcache
run: aws cloudfront create-invalidation --distribution-id E33GWS6MGOFKJZ --paths "/*"