Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

chore(): add ci back #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
machine:
node:
version: 5.1.0

general:
branches:
only:
- master # ignore PRs and branches

dependencies:
pre:
- ./scripts/prepare.sh
cache_directories:
- "~/ionic-site" # cache ionic-site

test:
override:
- ./scripts/test.sh

deployment:
staging:
branch: master
commands:
- ./scripts/deploy.sh
7 changes: 7 additions & 0 deletions scripts/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sitePath": "../ionic-site",
"docsDir": "docs/v2/components",
"docsDest": "../ionic-site/docs/v2/components",
"demoDir": "dist/preview-app",
"demoDest": "../ionic-site/dist/preview-app"
}
50 changes: 50 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

echo "##### "
echo "##### ci/deploy.sh"
echo "#####"


function init {
SITE_PATH=$(readJsonProp "config.json" "sitePath")
DEMO_DEST=$(readJsonProp "config.json" "demoDest")
cd ..
export BASE_DIR=$PWD
SITE_DIR=$BASE_DIR/$SITE_PATH
}

function run {
VERSION=$(readJsonProp "package.json" "version")

# process new docs
echo "Copying www to $DEMO_DEST"
rm -R $DEMO_DEST/www
cp -R www $DEMO_DEST

# CD in to the site dir to commit updated docs
cd $SITE_DIR

CHANGES=$(git status --porcelain)

# if no changes, don't commit
if [[ "$CHANGES" == "" ]]; then
#if [[ true ]]; then
echo "-- No changes detected for the following commit, docs not updated."
echo "https://github.com/driftyco/$CIRCLE_PROJECT_REPONAME/commit/$CIRCLE_SHA1"
else
git config --global user.email "[email protected]"
git config --global user.name "Ionitron"
git add -A
git commit -am "Automated build of driftyco/$CIRCLE_PROJECT_REPONAME@$CIRCLE_SHA1"
# in case a different commit was pushed to ionic-site during doc/demo gen,
# try to rebase around it before pushing
git fetch
git rebase

git push origin master

echo "-- Updated docs for $VERSION_NAME succesfully!"
fi
}

source $(dirname $0)/utils.inc.sh
30 changes: 30 additions & 0 deletions scripts/git/clone.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

ARG_DEFS=(
"--repository=(.*)"
"--directory=(.*)"
"[--depth=(.*)]"
"[--branch=(.*)]"
)

function run {
rm -rf $DIRECTORY
mkdir -p $DIRECTORY

echo "-- Cloning $REPOSITORY#$BRANCH to $DIRECTORY..."

ARGS="--branch=${BRANCH:-master} --depth=3"
if [[ "$DEPTH" != "" ]]; then
ARGS="$ARGS --depth=$DEPTH"
fi

git config --global user.email "[email protected]"
git config --global user.name "Ionitron"

git clone [email protected]:driftyco/$REPOSITORY.git $DIRECTORY $ARGS
cd $DIRECTORY
git fetch origin --tags
cd ../
}

source $(dirname $0)/../utils.inc.sh
31 changes: 31 additions & 0 deletions scripts/prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

echo "##### "
echo "##### prepare.sh"
echo "#####"


function init {
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"
else
echo "using existing"
cd $SITE_DIR
git reset --hard
git pull origin master
fi
}

source $(dirname $0)/utils.inc.sh
17 changes: 17 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

echo "##### "
echo "##### test.sh"
echo "#####"


# function init {
#
# }

function run {

npm run build --dev
}

source $(dirname $0)/utils.inc.sh
Loading