Jenkins 脚本小记

使用Jenkins持续集成

部署:

#!/bin/sh
PATH=$PATH:/usr/local/bin
PATH=$PATH:/usr/local/git/bin
BUILD_ID=dontKillMe
export NODE_ENV=staging

cd /web
rm -rf openclassmanager

git clone git@bitbucket.org:iplayabc/openclassmanager.git

更新

#!/bin/sh
PATH=$PATH:/usr/local/bin
PATH=$PATH:/usr/local/git/bin
BUILD_ID=dontKillMe
export NODE_ENV=staging

# 进入项目目录
cd /web/openclassmanager

# 保存发布的时间
rm -f "[deploy]"*.txt
time=`date '+%Y-%m-%d_%H-%M-%S'`
echo $time
touch "[deploy]"$time.txt


echo [Pull latest code from SCM]
# develop 即为开发版本分支最终提交
git checkout staging
git pull

echo [install npm components]
yarn install
yarn buildProd

echo [End]
Show Comments