[guadec-web] Updated deploy script to make easier to publish changes



commit 6e4a9f4f8285566968c19972e45381674bcf3b33
Author: Oliver Gutierrez <ogutsua gmail com>
Date:   Thu Mar 1 19:14:16 2018 +0000

    Updated deploy script to make easier to publish changes

 deploy.sh |   34 ++++++++++++++++++++++++----------
 1 files changed, 24 insertions(+), 10 deletions(-)
---
diff --git a/deploy.sh b/deploy.sh
old mode 100644
new mode 100755
index 2e65e49..ff80e89
--- a/deploy.sh
+++ b/deploy.sh
@@ -1,8 +1,10 @@
-#!/bin/sh
+#!/bin/bash
 
-OUTPUT_DIR='output'
-RSYNC_SERVER='root matrixhas me:/srv/nginx/websites'
-SITE_DIRECTORY='guadec.matrixhas.me'
+DATE=$(date)
+SOURCE_REPO='ssh://git.gnome.org/git/guadec-web'
+OUTPUT_BRANCH='guadec-2018'
+OUTPUT_DIR=$(mktemp)
+CURR_BRANCH=$(git rev-parse --abbrev-ref HEAD)
 
 if [ ! -d env ]; then
     echo "Creating virtual environment"
@@ -16,14 +18,26 @@ else
     source ./env/bin/activate
 fi
 
-echo "Removing old data"
-rm -rf $OUTPUT_DIR
+if [ ! -d node_modules ]; then
+    echo "Installing node.js modules"
+    npm install
+fi
+
+# echo "Preparing output dir"
+# git clone $SOURCE_REPO --branch $OUTPUT_BRANCH --single-branch $OUTPUT_DIR/
+
+echo "Generating theme data"
+grunt
 
 echo "Generating website in $OUTPUT_DIR directory"
-pelican -s publishconf.py
+pelican -s publishconf.py -o $OUTPUT_DIR
+
+echo "Publishing data to $OUTPUT_BRANCH branch"
+git checkout $OUTPUT_BRANCH && \
+    git --git-dir=.git --work-tree=$OUTPUT_DIR add $OUTPUT_DIR/. && \
+    git commit -m "Updated static website using deploy script on $DATE" && \
+    git push origin $OUTPUT_BRANCH
 
-echo "Syncing website content to $2"
-rsync -avc -e "ssh -p 2022" --delete output/ $RSYNC_SERVER/$SITE_DIRECTORY/
+git checkout $CURR_BRANCH
 
-echo "Deactivating virtual environment"
 deactivate


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]