-
Notifications
You must be signed in to change notification settings - Fork 1
/
buildspec.yml
46 lines (45 loc) · 1.91 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
version: 0.2
phases:
install:
runtime-versions:
nodejs: 10
commands:
- npm install
- npm install -g loose-envify
- wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.deb
- dpkg -i hugo_${HUGO_VERSION}_Linux-64bit.deb
finally:
- hugo version
pre_build:
commands:
- node ./scripts/replace-platacon-url.js
- node ./scripts/rename-languages.js
- node ./scripts/get-data.js
finally:
- echo "Finished executing pre-build scripts"
build:
commands:
- hugo --environment ${ENV}
- node ./scripts/update-netlify-config.js
- cd public/ && loose-envify ./admin/main.js > updated-main.js && mv updated-main.js main.js
- |
aws s3api head-object --bucket ${BUCKET_S3} --key ${DEST_FOLDER}/es/index.json || not_exist=true
if [ $not_exist ]; then
echo "index.json does not exist"
else
echo "index.json exists"
aws s3 cp s3://${BUCKET_S3}/${DEST_FOLDER}/es/index.json ./previous-index.json
node ../scripts/create-to-delete-index.js
fi
- aws s3 sync . s3://${BUCKET_S3}/${DEST_FOLDER} --delete --exclude "ca/grups/*" --exclude "es/grups/*" --exclude "en/grups/*" --exclude "css/*_gr.css" --exclude "css/*_gr.js"
- |
if [ "${UPLOAD_TO_CLOUDSEARCH}" == "true" ]; then
echo "Uploading data to cloudsearch"
cd .. && aws cloudsearchdomain --endpoint-url ${CLOUDSEARCH_URL} upload-documents --content-type application/json --documents ./index.json
if test -f "./index-to-delete.json"; then
aws cloudsearchdomain --endpoint-url ${CLOUDSEARCH_URL} upload-documents --content-type application/json --documents ./index-to-delete.json
fi
fi
finally:
- bash ./scripts/invalidations.sh
- echo "Script finished running"