Skip to content

Commit

Permalink
add update.sh script
Browse files Browse the repository at this point in the history
  • Loading branch information
philshem committed Mar 22, 2021
1 parent d887122 commit a60ef39
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 22 deletions.
2 changes: 1 addition & 1 deletion dataops
36 changes: 16 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"nprogress": "^0.2.0",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"sitemap": "^6.3.5"
"sitemap": "^6.4.0"
},
"devDependencies": {
"babel-plugin-inline-react-svg": "^1.1.1",
Expand Down
26 changes: 26 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# this script updates the data behind the co2birth.date site
# takes some time to build all the pages
# and may heat up your computer

# refresh data
# https://github.com/co2birthdate/dataops
git submodule foreach git pull origin master

# install node packages
npm i

# generate indidvidual pages, based on date
npm run export

# generate sitemap
npm install --save sitemap
echo "https://co2birth.date" > listofurls.txt && \
find out/co2 -name "*.html" -maxdepth 1 -type f | \
sed 's/out/https:\/\/co2birth.date/g' >> listofurls.txt && \
npx sitemap --index-base-url https://co2birth.date < listofurls.txt > out/sitemap.xml && \
rm -f listofurls.txt && gzip -f out/sitemap.xml

# deploy site to github "pages" branch
npm run deploy

0 comments on commit a60ef39

Please sign in to comment.