-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathwebspec.yml
45 lines (36 loc) · 1.33 KB
/
webspec.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
version: 0.2
phases:
install:
commands:
- echo "Installing Hugo..."
- curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep "download_url.*Linux-64bit.tar.gz" | grep -v "extended" | cut -d '"' -f 4 | wget -qi -
- HUGO_TAR="$(find . -name "*Linux-64bit.tar.gz")"
- tar -xzf $HUGO_TAR
- chmod +x hugo
- mv hugo /usr/local/bin/hugo
- hugo version
pre_build:
commands:
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- IMAGE_TAG=${COMMIT_HASH:=latest}
- echo "Initializing Git Repo"
- git init
- git remote add origin $FULL_REPO_URL
- git fetch
- git checkout -f "$CODEBUILD_RESOLVED_SOURCE_VERSION"
- echo "Initializing and updating Git submodules..."
- git submodule sync
- git submodule update --init --recursive
- echo "Installing dependencies..."
- gem install asciidoctor
build:
commands:
- echo "Building Website..."
- hugo -D -d public
- echo "Deploying Website to S3..."
- aws s3 sync public/ s3://${WEB_SITE_BUCKET}/ --delete
- echo "Invalidating CloudFront Cache..."
- aws cloudfront create-invalidation --distribution-id ${CLOUDFRONT_DISTRO_ID} --paths "/*"
post_build:
commands:
- echo "Build completed successfully!"