`
yl.fighter
  • 浏览: 253166 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

SVN 自动发布

阅读更多
实现过程,是使用了svn的一个hook的功能,我们调用了 post-commit 来做一些当提交完成后的操作。

1. 在版本库的hooks目录下面,有一些基于事件触发的执行脚本,比如post-commit, 去掉后缀.tmpl
2. 编辑svn代码库服务器上文件: svn/test/hooks/post-commit
#!/bin/sh

REPOS="$1"
REV="$2"
export PATH="/usr/local/svn/bin:$PATH"  #由于代码是apache的进程用户www运行,所以需要设置环境变量
export LC_CTYPE=en_US.UTF-8             #防止提交的文件名存在非字母字符。  
if (svnlook log -r $REV /home/http/repository/svn/test | grep "auto_deploy" )  #当用户提交时注释中写上"auto_deploy"的时候,就自动部署到apache目录,否则不部署。
then
  echo "`date` 'auto depoly command received" >> /tmp/test_svnautocommit.txt   #这一行仅作调试使用
  svn export "http://192.168.16.48/repo/svn/test/trunk/test_website"  /home/http/html/test_website  --force
fi
 2. 在客户端测试,并且要在comment中加入 auto_deploy,否则不会触发自动部署的操作。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics