-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildspec.yml
48 lines (46 loc) · 1.73 KB
/
buildspec.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
version: 0.2
env:
variables:
HUGO_VERSION: "0.123.8"
DART_SASS_VERSION: "1.70.0"
DOMAIN: "nicorossi.net"
phases:
install:
runtime-versions:
nodejs: 20
commands:
- apt-get update
- apt-get upgrade -y
- apt-get install -y jq curl
# Install Dart Sass
- curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
- tar -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
- cp -r dart-sass/* /usr/local/bin
- rm -rf dart-sass*
# Install Hugo
- curl -LJO https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb
- apt install -y ./hugo_extended_${HUGO_VERSION}_linux-amd64.deb
- rm hugo_extended_${HUGO_VERSION}_linux-amd64.deb
- hugo env
finally:
- echo Installation done
build:
commands:
- echo Build started on `date`
- echo Source files from $CODEBUILD_SRC_DIR/code
- cd $CODEBUILD_SRC_DIR/code
- npm install shx
- npm run clean
- npm install
- npm run build
post_build:
commands:
# Invalidate Cloudfront cache
- CLOUDFRONT_DISTRIBUTION_ID=$(aws cloudfront list-distributions --region us-east-1 --query "DistributionList.Items[?Aliases.Items[0]=='${DOMAIN}'].Id" --output text)
- INVALIDATION_ID=$(aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths /* --query "Invalidation.Id" --output text)
- aws cloudfront wait invalidation-completed --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --id $INVALIDATION_ID
artifacts:
files:
- '**/*'
base-directory: $CODEBUILD_SRC_DIR/code/public/
discard-paths: no