chore(CI): refactoring CI scripts for security and performance

This commit is contained in:
perry
2016-05-05 14:31:02 -05:00
parent 67590745e4
commit d643915bab
4 changed files with 46 additions and 27 deletions

View File

@ -3,6 +3,8 @@ general:
ignore: ignore:
- ins_n_outs - ins_n_outs
dependencies: dependencies:
pre:
- ./scripts/docs/prepare.sh
cache_directories: cache_directories:
- "~/ionic-site" # cache ionic-site - "~/ionic-site" # cache ionic-site
machine: machine:
@ -11,8 +13,8 @@ machine:
test: test:
override: override:
- echo "Automatically marking tests as passing for now" - echo "Automatically marking tests as passing for now"
#deployment: deployment:
# tasks: tasks:
# branch: "2.0" branch: "2.0"
# commands: commands:
# - ./scripts/ci/deploy.sh - ./scripts/ci/deploy.sh

View File

@ -13,20 +13,6 @@ function init {
SITE_PATH=$(readJsonProp "config.json" "sitePath") SITE_PATH=$(readJsonProp "config.json" "sitePath")
SITE_DIR=$IONIC_DIR/$SITE_PATH SITE_DIR=$IONIC_DIR/$SITE_PATH
DOCS_DEST=$(readJsonProp "config.json" "docsDest") 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 { function run {

33
scripts/docs/prepare.sh Executable file
View File

@ -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

View File

@ -3,7 +3,6 @@
ARG_DEFS=( ARG_DEFS=(
"--repository=(.*)" "--repository=(.*)"
"--directory=(.*)" "--directory=(.*)"
"[--depth=(.*)]"
"[--branch=(.*)]" "[--branch=(.*)]"
) )
@ -13,13 +12,12 @@ function run {
echo "-- Cloning $REPOSITORY#$BRANCH to $DIRECTORY..." echo "-- Cloning $REPOSITORY#$BRANCH to $DIRECTORY..."
ARGS="--branch=${BRANCH:-master}" ARGS="--branch=${BRANCH:-master} --depth=2"
if [[ "$DEPTH" != "" ]]; then
ARGS="$ARGS --depth=$DEPTH" git config --global user.email "hi@ionicframework.com"
else git config --global user.name "Ionitron"
ARGS="$ARGS --depth=2"
fi git clone git@github.com:driftyco/$REPOSITORY.git $DIRECTORY $ARGS
git clone https://driftyco:$GH_TOKEN@github.com/$REPOSITORY $DIRECTORY $ARGS
cd $DIRECTORY cd $DIRECTORY
git fetch origin --tags git fetch origin --tags
cd ../ cd ../