-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathamplify.yml
More file actions
52 lines (51 loc) · 3.49 KB
/
amplify.yml
File metadata and controls
52 lines (51 loc) · 3.49 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
version: 1.0
frontend:
phases:
preBuild:
commands:
- echo Installing Hugo ...
- wget -q https://github.com/gohugoio/hugo/releases/download/v0.81.0/hugo_extended_0.81.0_Linux-64bit.tar.gz
- tar -xf hugo_extended_0.81.0_Linux-64bit.tar.gz hugo
- mv hugo /usr/bin/hugo
- rm -rf hugo_extended_0.81.0_Linux-64bit.tar.gz
- echo Successfully installed Hugo
build:
commands:
# Install docraptor and requests libraries
- if [ "${AWS_BRANCH}" = "master" ]; then pip3 install urllib3==1.26.12 docraptor requests markdownify; fi
#- if [ "${AWS_BRANCH}" = "stu-stage" ]; then pip3 install markdownify; fi
# This only runs in the master branch, and assumes that stage was merged into master to trigger the build
# build_pdfs.py <DOCRAPTOR_API_KEY> <BASE_URL>
# If PDF/XLS generation is failing, comment out the following line to build the site.
# COMMENTED OUT BELOW after NetQ 4.14 rn.xml download failure
- if [ "${AWS_BRANCH}" = "master" ]; then python3 utils/build_pdf_xls.py $DOCRAPTOR_KEY https://stage.d1l3582pfvms7p.amplifyapp.com/networking-ethernet-software/ x x ; fi
#
# If branch is defined below, manually update the Netguru copilot js
- if [ "${AWS_BRANCH}" = "master" ]; then wget --no-check-certificate -O themes/netDocs/assets/js/netguru.js https://copilot-netguru.nvidia.com/chainlit/copilot/index.js ; fi
# If branch is master as defined below, manually overwrite themes/netDocs/layouts/partials/head.html with themes/netDocs/layouts/partials/head_master_only.html - this only brings in the OneTrust cookie consent script in the master branch
- if [ "${AWS_BRANCH}" = "master" ]; then cp themes/netDocs/layouts/partials/head_master_only.html themes/netDocs/layouts/partials/head.html ; fi
# Overwrite them head.html with stage-head.html to force no search indexing of stage servers
- if [ "${AWS_BRANCH}" != "master" ]; then mv themes/netDocs/layouts/partials/stage-head.html themes/netDocs/layouts/partials/head.html; fi
# Don't minify in non-prod branches to simplify troubleshooting
- if [ "${AWS_BRANCH}" != "master" ]; then hugo -D --baseURL $BASEURL -d public/networking-ethernet-software/ ; fi
- if [ "${AWS_BRANCH}" = "master" ]; then hugo --minify --baseURL $BASEURL ; fi
#
# Amplify requires that an index page exists. Generate one for stage.
- if [ "${AWS_BRANCH}" != "master" ]; then echo "<html><head></head><body><a href='networking-ethernet-software/''>click here</a></body></html>" > public/index.html ; fi
#
# Modify the PDF pages
# Install python beautifulsoup for html parsing
- pip3 install beautifulsoup4
# Run markdownify in master to produce simple markdown for post-build html docs
- if [ "${AWS_BRANCH}" = "master" ]; then python3 utils/html-to-markdown.py --url-replace $MDAMPURLREPLACE ; fi
# Pass the /public root directory for master
- if [ "${AWS_BRANCH}" = "master" ]; then python3 utils/pdf_page_editor.py public/ ; fi
# Default is /public/networking-ethernet-software
- if [ "${AWS_BRANCH}" != "master" ]; then python3 utils/pdf_page_editor.py ; fi
# Run markdownify in stu-stage for testing
#- if [ "${AWS_BRANCH}" = "stu-stage" ]; then python3 utils/html-to-markdown.py --url-replace $MDAMPURLREPLACE ; fi
- tree
artifacts:
files:
- '**/*'
baseDirectory: public