Jer*_*mmy 0 linux deployment bash path repository
我需要根据该文件的当前路径将相同的存储库部署在不同的路径中
例子:
如果此.Cpanel.yml位于位于“/home/foo/repository/foo_prod/”的存储库中,则在/home/foo/public_html/Production_folder/处实现它,但如果文件位置 binder . cpanel.yml位于“/home/foo/repository/foo_pre_prod/”中,因此在/home/foo/public_html/pre_prod_folder/中实现它
当前文件.cpanel.yml
---
deployment:
tasks:
- export DEPLOYPATH=/home/foo/public_html/xyz/
- /bin/cp -R * $DEPLOYPATH
Run Code Online (Sandbox Code Playgroud)
也许尝试这样的事情:
deployment:
tasks:
- current_branch=$(git branch --show-current) # set current branch to variable
- if [ $current_branch == "master" ]; then export DEPLOYPATH=/home/foo/public_html/xyz/; fi;
- if [ $current_branch == "develop" ]; then export DEPLOYPATH=/home/foo/public_html/xyz_dev/; fi;
- /bin/cp -R * $DEPLOYPATH
Run Code Online (Sandbox Code Playgroud)