-
-
Notifications
You must be signed in to change notification settings - Fork 3
74 lines (62 loc) · 1.85 KB
/
cloudfront.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
name: Deploy to AWS S3/CloudFront
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
id-token: write
contents: read
concurrency:
group: "cloudfront"
cancel-in-progress: true
# Default to bash
defaults:
run:
shell: bash
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Configure AWS credentials
uses: aws-actions/[email protected]
with:
role-to-assume: arn:aws:iam::911986281031:role/github-actions-major.io-blog
role-duration-seconds: 900
aws-region: us-east-1
- name: Build with Hugo
env:
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: hugo --minify
- name: Fix RSS feed
run: |
mkdir -vp public/feed
cp public/index.xml public/feed/index.xml
cp public/index.xml public/feed/index.html
- name: Download s3deploy
run: |
export S3DEPLOY_VERSION=2.11.0
curl -sLO https://github.com/bep/s3deploy/releases/download/v${S3DEPLOY_VERSION}/s3deploy_${S3DEPLOY_VERSION}_linux-amd64.tar.gz
tar -xzf s3deploy_${S3DEPLOY_VERSION}_linux-amd64.tar.gz s3deploy
chmod +x s3deploy
- name: Deploy to S3 using s3deploy
run: |
./s3deploy \
--try \
--acl public-read \
--region us-east-1 \
--bucket major.io \
--source public \
--distribution-id E2CVUP8JO07HJ2
# - name: Deploy to S3 using hugo's built-in deploy command
# run: hugo deploy --force --maxDeletes -1 --invalidateCDN