-
Notifications
You must be signed in to change notification settings - Fork 8
/
action.yml
75 lines (68 loc) · 1.97 KB
/
action.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
75
name: "Deploy Hugo to S3"
description: "Build and deploy Hugo static websites to AWS S3"
author: "AlbertMorenoDEV"
branding:
icon: package
color: yellow
inputs:
hugo-version:
description: "Choose a valid Hugo version"
required: true
aws-access-key-id:
description: "AWS Access Key ID"
required: true
aws-secret-access-key:
description: "AWS Secret Access Key"
required: true
target:
description: "A deployment target"
required: false
default: ""
config:
description: "Config file"
required: false
default: ""
environment:
description: "environment"
required: false
default: ""
skip-deployment:
description: "Skip deployment to AWS"
required: false
default: "false"
runs:
using: "composite"
steps:
- id: install-hugo
run: |
HUGO_DOWNLOAD=hugo_extended_withdeploy_${{ inputs.hugo-version }}_Linux-64bit.tar.gz
wget https://github.com/gohugoio/hugo/releases/download/v${{ inputs.hugo-version }}/${HUGO_DOWNLOAD}
tar xvzf ${HUGO_DOWNLOAD} hugo
mv hugo $HOME/hugo
shell: bash
- id: download-themes
run: |
git submodule init
git submodule update
shell: bash
- id: hugo-build
run: $HOME/hugo
shell: bash
- id: deploy-to-s3
if: inputs.skip-deployment == 'false'
run: |
HUGO_FLAGS=" --logLevel info --invalidateCDN --maxDeletes -1"
if [[ "${{ inputs.environment }}" ]]; then
HUGO_FLAGS="$HUGO_FLAGS --environment=${{ inputs.environment }}"
fi
if [[ "${{ inputs.config }}" ]]; then
HUGO_FLAGS="$HUGO_FLAGS --config=${{ inputs.config }}"
fi
if [[ "${{ inputs.target }}" ]]; then
HUGO_FLAGS="$HUGO_FLAGS --target=${{ inputs.target }}"
fi
$HOME/hugo deploy $HUGO_FLAGS
env:
AWS_ACCESS_KEY_ID: ${{ inputs.aws-access-key-id }}
AWS_SECRET_ACCESS_KEY: ${{ inputs.aws-secret-access-key }}
shell: bash