Skip to content
This repository has been archived by the owner on Jun 1, 2020. It is now read-only.

Commit

Permalink
lazy error catching xD
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterDaveHello committed Jun 1, 2015
1 parent 53016cb commit 443cf59
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions update-website.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ cd "$basePath/$mainRepo"

if [ "$hasLocalRepo" = true ] && [ -d "$basePath" ]; then
Green "Exist cdnjs local repo, fetch objects from local branch first"
git fetch local
git fetch local || Red "Error"
else
Cyan "Local repo not found, will grab object(s) from GitHub"
fi
Expand All @@ -39,40 +39,40 @@ if [ "$status" = "Current branch master is up to date." ]; then
Cyan "Cdnjs main reop is up to date, no need to rebuild";
else
Green "Rebuild meta data phase 1"
git -C $basePath/$webRepo checkout meta
node build/packages.json.js
git -C $basePath/$webRepo checkout meta || Red "Error"
node build/packages.json.js || Red "Error"

Green "Rebuild meta data phase 2"
cd $basePath/$webRepo
node update.js
cd $basePath/$webRepo || Red "Error"
node update.js || Red "Error"

Green "Commit meta data update in website repo"
for file in atom.xml packages.min.json rss.xml sitemap.xml
do
git -C $basePath/$webRepo add public/$file
git -C $basePath/$webRepo add public/$file || Red "Error"
done
git -C $basePath/$webRepo commit --message="meta data"
git -C $basePath/$webRepo commit --message="meta data" || Red "Error"

updateMeta=true
fi

Cyan "Change directory into website repo and checkout to master branch"
cd $basePath/$webRepo
git checkout master
git checkout master || Red "Error"

Cyan "Pull website repo with rebase from origin(Repo)"
webstatus=`git pull --rebase`
if [ "$webstatus" = "Current branch master is up to date." ]; then
Cyan "Website master branch up to date, no need to update meta branch"
else
Green "Rebase website's meta branch on master"
git rebase master meta
git rebase master meta || Red "Error"
updateRepo=true
fi

if [ "$updateMeta" = true ]; then
Green "Now push and deploy website & api"
git push origin meta -f
git push origin meta -f || Red "Error"
for remote in heroku heroku2
do
git push $remote meta:master -f
Expand All @@ -81,15 +81,15 @@ if [ "$updateMeta" = true ]; then
fi
done
Green "Now rebuild algolia search index"
git checkout meta
git checkout meta || Red "Error"
if [ -z "$githubToken" ] || [ -z "$algoliaToken" ]; then
GITHUB_OAUTH_TOKEN=$githubToken ALGOLIA_API_KEY=$algoliaToken node reindex.js
GITHUB_OAUTH_TOKEN=$githubToken ALGOLIA_API_KEY=$algoliaToken node reindex.js || Red "Error"
else
Red "Missing GitHub or algolia api key, cannot rebuild the searching index"
fi
elif [ "$updateRepo" = true ]; then
Green "Now push and deploy website only, no need to deploy api due to meta data no update"
git push heroku meta:master -f
git push heroku meta:master -f || Red "Error"
else
Cyan "Didn't update anything, no need to push or deploy."
fi

0 comments on commit 443cf59

Please sign in to comment.