From d643915bab5d457ba2a15164b434de7a13c6ad4f Mon Sep 17 00:00:00 2001 From: perry Date: Thu, 5 May 2016 14:31:02 -0500 Subject: [PATCH] chore(CI): refactoring CI scripts for security and performance --- circle.yml | 12 +++++++----- scripts/docs/deploy.sh | 14 -------------- scripts/docs/prepare.sh | 33 +++++++++++++++++++++++++++++++++ scripts/git/clone.sh | 14 ++++++-------- 4 files changed, 46 insertions(+), 27 deletions(-) create mode 100755 scripts/docs/prepare.sh diff --git a/circle.yml b/circle.yml index 0e09d39ea6..0cf60d8d08 100644 --- a/circle.yml +++ b/circle.yml @@ -3,6 +3,8 @@ general: ignore: - ins_n_outs dependencies: + pre: + - ./scripts/docs/prepare.sh cache_directories: - "~/ionic-site" # cache ionic-site machine: @@ -11,8 +13,8 @@ machine: test: override: - echo "Automatically marking tests as passing for now" -#deployment: -# tasks: -# branch: "2.0" -# commands: -# - ./scripts/ci/deploy.sh +deployment: + tasks: + branch: "2.0" + commands: + - ./scripts/ci/deploy.sh diff --git a/scripts/docs/deploy.sh b/scripts/docs/deploy.sh index 0266055292..fb4f501a35 100755 --- a/scripts/docs/deploy.sh +++ b/scripts/docs/deploy.sh @@ -13,20 +13,6 @@ function init { SITE_PATH=$(readJsonProp "config.json" "sitePath") SITE_DIR=$IONIC_DIR/$SITE_PATH DOCS_DEST=$(readJsonProp "config.json" "docsDest") - - if [ ! -d "$SITE_DIR" ]; then - echo "checking out" - ./git/clone.sh --repository="driftyco/ionic-site" \ - --directory="$SITE_DIR" \ - --branch="master" \ - --depth=1 - else - echo "using existing" - cd $SITE_DIR - git reset --hard - git pull origin master - cd $IONIC_DIR/scripts - fi } function run { diff --git a/scripts/docs/prepare.sh b/scripts/docs/prepare.sh new file mode 100755 index 0000000000..810a025580 --- /dev/null +++ b/scripts/docs/prepare.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +echo "##### " +echo "##### prepare.sh" +echo "#####" + + +function init { + cd .. + SITE_PATH=$(readJsonProp "config.json" "sitePath") + cd .. + export IONIC_DIR=$PWD + SITE_DIR=$IONIC_DIR/$SITE_PATH +} + +function run { + + if [ ! -d "$SITE_DIR" ]; then + echo "checking out" + cd ./scripts + ./git/clone.sh --repository="ionic-site" \ + --directory="$SITE_DIR" \ + --branch="master" + ls -al $SITE_DIR + else + echo "using existing" + cd $SITE_DIR + git reset --hard + git pull origin master + fi +} + +source $(dirname $0)/../utils.sh.inc diff --git a/scripts/git/clone.sh b/scripts/git/clone.sh index 2eb173ebe7..7e2d277351 100755 --- a/scripts/git/clone.sh +++ b/scripts/git/clone.sh @@ -3,7 +3,6 @@ ARG_DEFS=( "--repository=(.*)" "--directory=(.*)" - "[--depth=(.*)]" "[--branch=(.*)]" ) @@ -13,13 +12,12 @@ function run { echo "-- Cloning $REPOSITORY#$BRANCH to $DIRECTORY..." - ARGS="--branch=${BRANCH:-master}" - if [[ "$DEPTH" != "" ]]; then - ARGS="$ARGS --depth=$DEPTH" - else - ARGS="$ARGS --depth=2" - fi - git clone https://driftyco:$GH_TOKEN@github.com/$REPOSITORY $DIRECTORY $ARGS + ARGS="--branch=${BRANCH:-master} --depth=2" + + git config --global user.email "hi@ionicframework.com" + git config --global user.name "Ionitron" + + git clone git@github.com:driftyco/$REPOSITORY.git $DIRECTORY $ARGS cd $DIRECTORY git fetch origin --tags cd ../