Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build.sh #73

Draft
wants to merge 56 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
84d58ce
Update build.sh
alexanderleegs Apr 7, 2022
9fd3d6a
Update build.sh
alexanderleegs Apr 7, 2022
4d2e5b5
Update build.sh
alexanderleegs Apr 7, 2022
073cb03
Update build.sh (#21)
rc-davis Apr 13, 2022
5abf94b
chore: moved JEKYLL_ENV out of build.sh and into Amplify env vars.
rc-davis Apr 14, 2022
e4bd394
feat: Install git lfs if available without throwing an error.
rc-davis May 24, 2022
e6053c0
feat: added customHttp.yml to overrides for Amplify builds.
rc-davis May 25, 2022
c5e0065
fix: tweak customHttp.yml to fix Amplify headers.
rc-davis May 25, 2022
50a5998
fix: tweaked build.sh for customHttp.yml debugging.
rc-davis May 25, 2022
51a29d0
fix: attempt to fix customHttp.yml
rc-davis May 25, 2022
af6c4ee
Update customHttp.yml
rc-davis May 25, 2022
df5e764
Update customHttp.yml
rc-davis May 25, 2022
a9f96d3
Update build.sh
rc-davis May 25, 2022
f6b6e0f
fix: removed netlify.toml and customHttp.yml
rc-davis May 25, 2022
1ba63d9
chore: find a tool that can parse and write yml files.
rc-davis May 26, 2022
9ba0e50
chore: try to install yq
rc-davis May 26, 2022
68969aa
chore: try other ways to install yq.
rc-davis May 26, 2022
63e5d12
fix: bring back the customHttp.yml override.
rc-davis May 26, 2022
356ea0a
fix: write customHttp.yml to the correct location.
rc-davis May 26, 2022
84dff7a
feat: add Strict-Transport-Security header.
rc-davis May 27, 2022
c4ad06c
chore: Added comment to cuttomHttp.yml's Strict-Transport-Security he…
rc-davis May 27, 2022
c5022e9
Update customHttp.yml
alexanderleegs Jan 5, 2023
4b9c15f
Merge pull request #30 from opengovsg/fix/google-calendar
alexanderleegs Jan 16, 2023
1203265
Update customHttp.yml
alexanderleegs Jan 17, 2023
585b237
Merge pull request #33 from opengovsg/feat/add-google-floodlight-amplify
alexanderleegs Jan 17, 2023
f5cc60a
Update customHttp.yml
alexanderleegs Jan 20, 2023
62899ff
Merge pull request #35 from opengovsg/feat/datastudio-amplify
alexanderleegs Jan 26, 2023
a937113
Feat: add lookerstudio.google.com
alexanderleegs Feb 22, 2023
1483617
Merge pull request #37 from opengovsg/feat/add-lookerstudio-amplify
alexanderleegs Feb 22, 2023
985843c
Feat/add inline script for GTM amplify
alexanderleegs Apr 25, 2023
a10e56d
Update customHttp.yml for GTM
alexanderleegs May 26, 2023
05a9ad9
Merge pull request #39 from opengovsg/Feat/add-inline-script-for-GTM-…
alexanderleegs Jun 5, 2023
59b0b3b
Update customHttp.yml
alexanderleegs Jun 14, 2023
7d4f0bb
Merge pull request #41 from opengovsg/feat/wizgov-amplify
alexanderleegs Jun 14, 2023
236f02c
Update customHttp.yml
alexanderleegs Jun 16, 2023
493ddb1
Merge pull request #43 from opengovsg/feat/allow-sgid-amplify
alexanderleegs Jun 16, 2023
b5b4d79
Update customHttp.yml
alexanderleegs Jun 19, 2023
e66a0d9
Merge pull request #45 from opengovsg/chore/update-wizgov-amplify
alexanderleegs Jun 19, 2023
5bba7ed
chore/staging wizgov amplify
alexanderleegs Jul 12, 2023
7290c14
Merge pull request #47 from opengovsg/chore/staging-wizgov-amplify
alexanderleegs Jul 12, 2023
5a4c81a
Feat/wogaa amplify (#49)
alexanderleegs Aug 31, 2023
b4bb175
Update customHttp.yml (#51)
alexanderleegs Sep 6, 2023
b7d3a89
feat(sass): compress SASS styles (#52)
dcshzj Sep 13, 2023
7fe2090
Update customHttp.yml (#54)
alexanderleegs Nov 20, 2023
1cd7e37
chore/amplify authmiddleware.ap.sabio.cloud (#57)
alexanderleegs Jan 17, 2024
48564f5
feat/datagov-api amplify (#59)
alexanderleegs Jan 23, 2024
02e7f32
Add https://vimeo.com to frame-src (#61)
dcshzj Feb 16, 2024
470d3e1
feat/add script-src for gtm load time (#64)
alexanderleegs Apr 5, 2024
4f34cf5
chore: add *.data.gov.sg to frame-src (#65)
dcshzj Apr 17, 2024
5ecb036
fix(algolia): allow for batching to work (#67)
kishore03109 Apr 23, 2024
28b301b
chore(amplify): lock-deps (#71)
seaerchin Jun 14, 2024
e264eee
fix(csp): add sabio for amplify (#74)
kishore03109 Jul 1, 2024
51a2469
chore: fix algolia whitelist on csp (#75)
alexanderleegs Jul 2, 2024
2d9ab8a
fix(sabio): add csp to style and connect src (#77)
kishore03109 Jul 3, 2024
fb2bb87
feat: remove no referrer (#78)
seaerchin Aug 21, 2024
476870b
chore/more vica whitelist amplify (#81)
alexanderleegs Oct 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
64 changes: 37 additions & 27 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
#!/bin/bash
#!/bin/bash

################################################
# Check repo is running on isomer v2 template. #
################################################
if ! grep -Fxq "remote_theme: isomerpages/isomerpages-template@next-gen" /opt/build/repo/_config.yml; then
echo "$1 is not on isomerpages/isomerpages-template@next-gen"
exit 1
if ! grep -Fxq "remote_theme: isomerpages/isomerpages-template@next-gen" _config.yml; then
echo "$1 is not on isomerpages/isomerpages-template@next-gen"
exit 1
fi

#################################################################
# Override netlify.toml with centrally-hosted netlify.toml file #
#################################################################
curl https://raw.githubusercontent.com/opengovsg/isomer-build/master/overrides/netlify.toml -o /opt/build/repo/netlify.toml
#####################################################################
# Override customHttp.yml with centrally-hosted customHttp.yml file #
#####################################################################
curl https://raw.githubusercontent.com/opengovsg/isomer-build/amplify/overrides/customHttp.yml -o customHttp.yml

###################################################################
# Obtain config override file to enforce plugins and remote theme #
###################################################################
curl https://raw.githubusercontent.com/opengovsg/isomer-build/master/overrides/_config-override.yml -o /opt/build/repo/_config-override.yml
curl https://raw.githubusercontent.com/opengovsg/isomer-build/master/overrides/_config-override.yml -o _config-override.yml

#####################################################
# Delete custom plugins from _plugins folder if any #
Expand All @@ -28,13 +28,13 @@ rm -rf _plugins
# The Gemfile can either reference isomer-jekyll #
# or github-pages #
##################################################
curl https://raw.githubusercontent.com/opengovsg/isomer-build/master/overrides/Gemfile-github-pages -o /opt/build/repo/Gemfile-github-pages
curl https://raw.githubusercontent.com/opengovsg/isomer-build/master/overrides/Gemfile-isomer-jekyll -o /opt/build/repo/Gemfile-isomer-jekyll
diff_line_count_github_pages_gemfile=$(diff --ignore-space-change /opt/build/repo/Gemfile /opt/build/repo/Gemfile-github-pages | wc -l)
diff_line_count_isomer_jekyll_gemfile=$(diff --ignore-space-change /opt/build/repo/Gemfile /opt/build/repo/Gemfile-isomer-jekyll | wc -l)
if (( diff_line_count_github_pages_gemfile > 0 && diff_line_count_isomer_jekyll_gemfile > 0 )); then
echo "Gemfile was tampered with"
exit 1
curl https://raw.githubusercontent.com/opengovsg/isomer-build/master/overrides/Gemfile-github-pages -o Gemfile-github-pages
curl https://raw.githubusercontent.com/opengovsg/isomer-build/master/overrides/Gemfile-isomer-jekyll -o Gemfile-isomer-jekyll
diff_line_count_github_pages_gemfile=$(diff --ignore-space-change Gemfile Gemfile-github-pages | wc -l)
diff_line_count_isomer_jekyll_gemfile=$(diff --ignore-space-change Gemfile Gemfile-isomer-jekyll | wc -l)
if ((diff_line_count_github_pages_gemfile > 0 && diff_line_count_isomer_jekyll_gemfile > 0)); then
echo "Gemfile was tampered with"
exit 1
fi

###############################################################
Expand All @@ -44,14 +44,24 @@ fi
collections=$(find . -path ./_site -prune -false -o -name collection.yml -type f)
var=$(echo $collections | sed 's/ .\//,.\//g')

env='development'
while getopts "e:" opt; do
case $opt in
e) env=$OPTARG ;;
*) echo 'error' >&2
exit 1
esac
done

# netlify build
JEKYLL_ENV=$env git lfs install && jekyll build --config _config.yml",$var",/opt/build/repo/_config-override.yml
#################################
# Install git lfs, if available #
#################################
if git lfs install; then
echo "git lfs installed"
else
echo "git lfs not installed"
fi

FILE="Gemfile.lock"

if [ -f "$FILE" ]; then
echo "The file $FILE exists. Removing it."
else
echo "The file $FILE does not exist."
fi

curl "https://raw.githubusercontent.com/isomerpages/isomerpages-template/next-gen/Gemfile.lock"

# Amplify build
bundle exec jekyll build --config _config.yml",$var",_config-override.yml
Empty file added lock-deps.sh
Empty file.
125 changes: 0 additions & 125 deletions netlify.toml

This file was deleted.

4 changes: 3 additions & 1 deletion overrides/_config-override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ plugins:

# Approved remote_theme
remote_theme: isomerpages/isomerpages-template@next-gen
safe: false
safe: false
sass:
style: compressed
164 changes: 164 additions & 0 deletions overrides/customHttp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# Changes to this file should be copied to overrides/netlify.toml in the master branch.
customHeaders:
- pattern: "**/*"
headers:
- key: X-XSS-Protection
value: 1; mode=block
- key: Referrer-Policy
value: strict-origin-when-cross-origin
- key: X-Content-Type-Options
value: nosniff
- key: X-Frame-Options
value: deny
- key: Strict-Transport-Security
# This header is added automatically by Netlify and KeyCDN.
value: max-age=31536000; includeSubDomains; preload
- key: Content-Security-Policy
# Amplify requires all lines in a multi-line string to have the same indentation.
value: >-
default-src
'self'
https://*.dcube.cloud/
;
script-src
'self'
'sha256-nWKjNpDy9BIIH8p69UATrM+dYfeHm3RCw7s03nOoDC0=' # Script for GTM tag
blob:
https://assets.dcube.cloud
https://*.wogaa.sg
https://assets.adobedtm.com
https://www.google-analytics.com
https://cdnjs.cloudflare.com
https://va.ecitizen.gov.sg
https://*.cloudfront.net
https://printjs-4de6.kxcdn.com
https://unpkg.com
https://unpkg.com/web-vitals
https://wogadobeanalytics.sc.omtrdc.net
https://connect.facebook.net
https://graph.facebook.com
https://facebook.com
https://www.facebook.com
https://*.googletagmanager.com
https://*.licdn.com
https://webchat.vica.gov.sg
https://vica.gov.sg
https://www.google.com/recaptcha/
https://www.gstatic.com/recaptcha/
https://api-chat-fe-flag.vica.gov.sg
https://static.zdassets.com
https://ekr.zdassets.com
https://*.zendesk.com
https://*.zopim.com
https://www.instagram.com
https://script.wiz.gov.sg/widget.js
https://script-staging.wiz.gov.sg/widget.js
wss://*.zendesk.com
wss://*.zopim.com
https://*.dcube.cloud/
https://console.apac.sabio.cloud/
https://console-flex-api.ap.sabio.cloud/
https://cdn.jsdelivr.net/npm/[email protected]/dist/algoliasearch-lite.umd.js
https://cdn.jsdelivr.net/npm/[email protected]/dist/instantsearch.production.min.js
;
object-src
'self'
;
style-src
'self'
'unsafe-inline'
https://fonts.googleapis.com/
https://*.cloudfront.net
https://va.ecitizen.gov.sg
https://*.wogaa.sg
https://cdnjs.cloudflare.com
https://datagovsg.github.io
https://webchat.vica.gov.sg
https://vica.gov.sg
https://unpkg.com
https://script.wiz.gov.sg/widget.css
https://script-staging.wiz.gov.sg/widget.css
https://assets.dcube.cloud/
https://console.apac.sabio.cloud/
https://console-flex-api.ap.sabio.cloud
https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/satellite-min.css
;
img-src
*
;
media-src
*
;
frame-src
https://form.gov.sg/
https://wogaa.demdex.net/
https://*.youtube.com
https://*.youtube-nocookie.com
https://*.vimeo.com
https://vimeo.com
https://www.google.com
https://checkfirst.gov.sg
https://www.checkfirst.gov.sg
https://docs.google.com
https://nlb.ap.panopto.com
https://www.google.com/recaptcha/
https://accounts.google.com
https://www.gstatic.com/recaptcha/
https://data.gov.sg
https://*.data.gov.sg
https://calendar.google.com
https://datastudio.google.com
https://lookerstudio.google.com
https://*.fls.doubleclick.net
https://www.facebook.com
https://m.facebook.com/
https://www.instagram.com
https://api.id.gov.sg/
;
frame-ancestors
'none'
;
font-src
*
data:
;
connect-src
'self'
https://dpm.demdex.net
https://*.google-analytics.com
https://analytics.google.com
https://*.googletagmanager.com
https://stats.g.doubleclick.net
https://*.wogaa.sg
https://va.ecitizen.gov.sg
https://ifaqs.flexanswer.com
https://*.cloudfront.net
https://fonts.googleapis.com
https://cdnjs.cloudflare.com
https://wogadobeanalytics.sc.omtrdc.net
https://data.gov.sg
https://api-production.data.gov.sg
https://api.isomer.gov.sg
https://webchat.vica.gov.sg
https://chat.vica.gov.sg
https://vica.gov.sg
https://s3-va-prd-vica.s3-ap-southeast-1.amazonaws.com
wss://chat.vica.gov.sg
https://api-vica-ana.vica.gov.sg/api/v1/response-ratings
https://api-chat-fe-flag.vica.gov.sg
https://static.zdassets.com
https://ekr.zdassets.com
https://*.zendesk.com
https://*.zopim.com
https://ask.gov.sg
https://staging.ask.gov.sg
wss://*.zendesk.com
wss://*.zopim.com
https://*.dcube.cloud/
https://console-flex-api.ap.sabio.cloud
https://console.apac.sabio.cloud/
https://authmiddleware.ap.sabio.cloud
https://*.algolia.net
https://*.algolianet.com
https://*.algolia.io
;
Loading