From 7c258e74f5a61758422bf1cec9c7dc712f8fcc7f Mon Sep 17 00:00:00 2001 From: Maruan Al-Shedivat Date: Sat, 1 Jul 2017 09:24:04 -0700 Subject: [PATCH 01/37] Make deploy script use bunlder --- bin/deploy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/deploy b/bin/deploy index 59d0668..f19c1f9 100755 --- a/bin/deploy +++ b/bin/deploy @@ -15,7 +15,7 @@ fi git checkout -b gh-pages # Build site. -jekyll build +bundle exec jekyll build # Delete and move files. find . -maxdepth 1 ! -name '_site' ! -name '.git' ! -name '.gitignore' -exec rm -rf {} \; From 3277b4e96e0c79e1cbf328627e0957f9278117a1 Mon Sep 17 00:00:00 2001 From: Maruan Al-Shedivat Date: Fri, 8 Sep 2017 12:20:38 -0400 Subject: [PATCH 02/37] Update .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 8c3ba11..e31aadd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ _site .sass-cache .jekyll-metadata .DS_store +.ruby-version +Gemfile.lock + From a47b1acd211693bab7f8892a99838319e1043d9e Mon Sep 17 00:00:00 2001 From: Maruan Al-Shedivat Date: Fri, 8 Sep 2017 12:51:25 -0400 Subject: [PATCH 03/37] Improve deploy script (addresses #6) --- bin/deploy | 77 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 62 insertions(+), 15 deletions(-) diff --git a/bin/deploy b/bin/deploy index f19c1f9..b4f0d7f 100755 --- a/bin/deploy +++ b/bin/deploy @@ -1,35 +1,82 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash -# Run this script to deploy the app to Github Pages. +# Run this script to deploy the app to Github Pages -# Exit if any subcommand fails. +# Parse cmd arguments + +SRC_BRANCH="master" +DEPLOY_BRANCH="gh-pages" + +USAGE_MSG="usage: deploy [-h|--help] [-u|--user] [-s|--src SRC_BRANCH] [-d|--deploy DEPLOY_BRANCH]" + +while [[ $# > 0 ]]; do + key="$1" + + case $key in + -h|--help) + echo $USAGE_MSG + exit 0 + ;; + -u|--user) + SRC_BRANCH="source" + DEPLOY_BRANCH="master" + shift + ;; + -s|--src) + SRC_BRANCH="$2" + shift + ;; + -d|--deploy) + DEPLOY_BRANCH="$2" + shift + ;; + *) + echo "Option $1 is unknown." + echo $USAGE_MSG + exit 0 + ;; + esac + shift +done + +# Exit if any subcommand fails set -e -echo "Started deploying" +echo "Deploying..." +echo "Source branch: $SRC_BRANCH" +echo "Deploy branch: $DEPLOY_BRANCH" -# Checkout gh-pages branch. -if [ `git branch | grep gh-pages` ] +# Switch to source branch (creates it if necessary from the current branch) +if [ `git branch | grep $SRC_BRANCH | tr ' ' '\n' | tail -1` ] then - git branch -D gh-pages + git checkout $SRC_BRANCH +else + git checkout -b $SRC_BRANCH fi -git checkout -b gh-pages -# Build site. +# Checkout DEPLOY_BRANCH branch +if [ `git branch | grep $DEPLOY_BRANCH` ] +then + git branch -D $DEPLOY_BRANCH +fi +git checkout -b $DEPLOY_BRANCH + +# Build site bundle exec jekyll build -# Delete and move files. +# Delete and move files find . -maxdepth 1 ! -name '_site' ! -name '.git' ! -name '.gitignore' -exec rm -rf {} \; mv _site/* . rm -R _site/ -# Push to gh-pages. +# Push to DEPLOY_BRANCH git add -fA git commit --allow-empty -m "$(git log -1 --pretty=%B) [ci skip]" -git push -f -q origin gh-pages +git push -f -q origin $DEPLOY_BRANCH -# Move back to previous branch. -git checkout - +# Move back to SRC_BRANCH +git checkout $SRC_BRANCH -echo "Deployed Successfully!" +echo "Deployed successfully!" exit 0 From 6cd780ef6d625e03a1a801e90af73928d4da2523 Mon Sep 17 00:00:00 2001 From: Maruan Al-Shedivat Date: Fri, 8 Sep 2017 13:01:41 -0400 Subject: [PATCH 04/37] Update README.md --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 04e0897..9be12ca 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,17 @@ Now, feel free to customize the theme however you like (don't forget to change t After you are done, you can deploy it to [GitHub Pages](https://pages.github.com/) by running the deploy script: ```bash -$ ./bin/deploy +$ ./bin/deploy [--user] +``` +By default, the script uses the `master` branch for the source code and deploys the webpage to `gh-pages`. +The optional flag `--user` tells it to deploy to `master` and use `source` for the source code instead. +Using `master` for deployment is a convention for [user and organization pages](https://help.github.com/articles/user-organization-and-project-pages/). + +**Note:** when deploying your user or organization page, make the `_config.yml` has `url` and `baseurl` fields as follows. + +``` +url: .github.io +baseurl: # should be empty ``` ## Features From 43df930fba896615c7a9fcf9bc17e6d90989cee2 Mon Sep 17 00:00:00 2001 From: Maruan Al-Shedivat Date: Tue, 26 Sep 2017 10:16:08 -0400 Subject: [PATCH 05/37] Ensure everything is committed before deploying --- bin/deploy | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bin/deploy b/bin/deploy index b4f0d7f..368633a 100755 --- a/bin/deploy +++ b/bin/deploy @@ -46,6 +46,22 @@ echo "Deploying..." echo "Source branch: $SRC_BRANCH" echo "Deploy branch: $DEPLOY_BRANCH" +read -r -p "Do you want to proceed? [y/N] " response +if [[ ! $response =~ ^([yY][eE][sS]|[yY])+$ ]] +then + echo "Aborting." + [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 +fi + +# Check if there are any uncommitted changes +if ! git diff-index --quiet HEAD --; then + echo "Changes to the following files are uncommitted:" + git diff-index --name-only HEAD -- + echo "Please commit the changes before proceeding." + echo "Aborting." + [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 +fi + # Switch to source branch (creates it if necessary from the current branch) if [ `git branch | grep $SRC_BRANCH | tr ' ' '\n' | tail -1` ] then From 02fcb9d43479f1bedbcf0beef52b949f3ddd804b Mon Sep 17 00:00:00 2001 From: Maruan Al-Shedivat Date: Tue, 26 Sep 2017 10:19:27 -0400 Subject: [PATCH 06/37] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9be12ca..1863ed2 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,8 @@ $ bundle exec jekyll serve ``` Now, feel free to customize the theme however you like (don't forget to change the name!). -After you are done, you can deploy it to [GitHub Pages](https://pages.github.com/) by running the deploy script: +After you are done, **commit** your final changes. +Now, you can deploy your website to [GitHub Pages](https://pages.github.com/) by running the deploy script: ```bash $ ./bin/deploy [--user] From db3257ff54df68f3ee2a285d9b0c9437aeb46608 Mon Sep 17 00:00:00 2001 From: Mayankm96 Date: Sat, 4 Nov 2017 07:36:57 +0530 Subject: [PATCH 07/37] google analyics liquid tag added --- _config.yml | 2 ++ _includes/hemline.html | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index fc3fb13..30d5146 100644 --- a/_config.yml +++ b/_config.yml @@ -24,6 +24,8 @@ scholar_authorid: # put your google scholar author id contact_note: > You can even add a little note about which of these is the best way to reach you. +google_analytics: UA-XXXXXXXXX # out your google-analytics code + # ----------------------------------------------------------------------------- # Blog # ----------------------------------------------------------------------------- diff --git a/_includes/hemline.html b/_includes/hemline.html index a96fb11..23ccad5 100644 --- a/_includes/hemline.html +++ b/_includes/hemline.html @@ -31,6 +31,6 @@ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); -ga('create', 'UA-XXXXXXXX-X', 'auto'); +ga('create', '{{ site.google_analytics }}', 'auto'); ga('send', 'pageview'); From 0562ac360ab2f87f8e26b3c07aa7364684b9804c Mon Sep 17 00:00:00 2001 From: Mayankm96 Date: Sat, 4 Nov 2017 07:37:39 +0530 Subject: [PATCH 08/37] fixed instruction for User deployment --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1863ed2..1f98383 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Using `master` for deployment is a convention for [user and organization pages]( **Note:** when deploying your user or organization page, make the `_config.yml` has `url` and `baseurl` fields as follows. ``` -url: .github.io +url: # should be empty baseurl: # should be empty ``` From 471825b973cb5de5e0fc973811cb751c687dad34 Mon Sep 17 00:00:00 2001 From: monkeywithacupcake Date: Sat, 6 Jan 2018 08:51:27 +0900 Subject: [PATCH 09/37] add hamburger to header.html --- _includes/header.html | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/_includes/header.html b/_includes/header.html index 3897da5..98358e5 100644 --- a/_includes/header.html +++ b/_includes/header.html @@ -10,6 +10,16 @@ {% endif %}