Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeS96 authored Apr 14, 2024
0 parents commit c889f1e
Show file tree
Hide file tree
Showing 9 changed files with 194 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
_site
/test-deploy.sh
.idea/
Gemfile.lock
.DS_Store
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "website-assets"]
path = website-assets
url = https://github.com/montrealrobotics/website-assets.git
branch = master
9 changes: 9 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
source 'https://rubygems.org'
group :jekyll_plugins do
gem 'github-pages'
gem 'jekyll'
gem 'jekyll-paginate'
gem 'jekyll-scholar'
gem 'jemoji'
gem 'unicode_utils'
end
28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# targets that aren't filenames
.PHONY: all clean deploy build serve

all: build


build:
bundle exec jekyll build

install:
bundle install

# you can configure these at the shell, e.g.:
# SERVE_PORT=5001 make serve
SERVE_HOST ?= 127.0.0.1
SERVE_PORT ?= 5000

serve:
bundle exec jekyll serve --port $(SERVE_PORT) --host $(SERVE_HOST)

deploy:
git commit -am"updating"; git push

clean:
$(RM) -r _site

deploy: clean build
./bin/deploy
24 changes: 24 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
url: https://montrealrobotics.github.io

includes_dir: website-assets/_includes
layouts_dir: website-assets/_layouts
sass:
sass_dir: website-assets/_sass
asset_dir: /website-assets/assets

base: ''

# Navigation bar links.
navigation:
- title: Home
link: /
- title: People
link: /people.html
- title: Research
link: /research.html
- title: Publications
link: /publications/
- title: Contact
link: /contact.html
- title: Blog
link: /blog.html
116 changes: 116 additions & 0 deletions bin/deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#!/usr/bin/env bash

# Run this script to deploy the app to Github Pages

# Parse cmd arguments

SRC_BRANCH="source"
DEPLOY_BRANCH="master"

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 "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
git checkout $SRC_BRANCH
else
git checkout -b $SRC_BRANCH
fi

# 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

git submodule deinit --all

# Delete and move files
find . -maxdepth 1 ! -name '_site' ! -name '.git' ! -name '.gitignore' -exec rm -rf {} \;
mv _site/* .
rm -R _site/
rm -rf .git/modules

# Push to DEPLOY_BRANCH

git add -fA
git commit --allow-empty -m "$(git log -1 --pretty=%B) [ci skip]"
git push -f -q origin $DEPLOY_BRANCH


git rm --cached website-assets
git commit -m"remove"
git push -f -q origin $DEPLOY_BRANCH
git add website-assets
git commit -m"add"
git push -f -q origin $DEPLOY_BRANCH

# Move back to SRC_BRANCH
git checkout $SRC_BRANCH
rm -rf website-assets
git submodule init
git submodule update
cd website-assets
git checkout master
cd ..
echo "Deployed successfully!"

exit 0
Empty file added img/ADD_PROJECT_IMAGES_HERE
Empty file.
7 changes: 7 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layout: default
title: Project template
permalink: index.html
---

Edit this
1 change: 1 addition & 0 deletions website-assets
Submodule website-assets added at 4b90f6

0 comments on commit c889f1e

Please sign in to comment.