登录
一般是使用公司的RAM用户登录
新建流水线
选择流水线模板
一般可以根据技术架构,选择不同的流水线模板,没有合适的就用自定义的即可。
选择代码源
可以根据公司代码,托管位置或仓库位置,选择代码源;
例如我们使用CodeUp
添加监听代码提交
CodeUp后台设置webhook
获取git版本
主机部署
部署脚本
cd /home/wwwroot
mkdir branch
git clone https://codeup.aliyun.com/xxx.git /home/wwwroot/xxx.cn
chmod -R 777 /home/wwwroot/branch
cd /home/wwwroot/xxx.cn
为 数据库数据表添加缓存(添加新字段时候需要运行此命令,不然有缓存不生效,缓存在runtime/schema文件夹)
docker exec -i php7.3 /bin/bash -c 'cd /home/wwwroot/xxx.cn/ && php think optimize:schema'
rm -rf runtime
cd /home/wwwroot/xxx.cn-20220105.bak/txxx.cn/public
cd /home/wwwroot/xxxx.cn
chmod -R 777 runtime
cd public
git config core.filemode false
git checkout -b testing
git branch
git status
docker exec -i php7.3 /bin/bash -c 'cd /home/wwwroot/xxx.cn/ && composer update'
git checkout testing
git reset --hard 061bc22b8a53fb83936c5c34978451a1ec9226c5
git status
git pull origin testing
你要保守你心,胜过保守一切。
作者:刘俊涛的博客