-
Notifications
You must be signed in to change notification settings - Fork 1
76 lines (72 loc) · 2.33 KB
/
hugo-build-deploy.yml
File metadata and controls
76 lines (72 loc) · 2.33 KB
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
name: Hugo s3 deploy
on:
workflow_call:
inputs:
hugo-src-dir:
description: 'Hugo source directory'
required: true
type: string
hugo-theme:
description: 'Hugo theme to use'
required: true
type: string
environment:
description: 'Environment to deploy to'
required: true
type: string
aws-iam-deployer-role:
description: 'Role ARN to assume for ECR'
required: true
type: string
aws-s3-bucket:
description: 'S3 bucket to deploy to'
required: true
type: string
aws-region:
description: 'AWS region'
required: true
type: string
default: 'us-east-1'
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
build:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Install Hugo CLI
run: |
sudo snap install hugo
- name: Build
run: hugo --minify --destination dist --source ${{inputs.hugo-src-dir}} --theme ${{ inputs.hugo-theme }}
- name: Archive build directory
uses: actions/upload-artifact@v6
with:
name: dist
path: ${{ inputs.hugo-src-dir }}/dist
deploy-prod:
environment:
name: ${{ inputs.environment }}
# only runs when the branch is main
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: build
steps:
- name: Download build artifact
uses: actions/download-artifact@v7
with:
name: dist
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: ${{ inputs.aws-iam-deployer-role }}
role-session-name: github_federated_aws
aws-region: ${{ inputs.aws-region }}
- name: Deploy Site to S3
env:
AWS_S3_BUCKET : ${{ inputs.aws-s3-bucket }}
run: |
aws s3 sync --delete --sse AES256 $GITHUB_WORKSPACE $AWS_S3_BUCKET