我想使用Gitlab CI触发存储在一个仓库中的Express API和React应用的持续部署。我正在使用shell executor。
这是我的目录结构
/server
/client
.gitlab-ci.yml
我的配置如下:
stages:
- deploy
server:
stage: deploy
script:
- npm run start
- forever restartall
only:
refs:
- staging
changes:
- server/
client:
script:
- npm run build --prefix ./client
stage: deploy
only:
refs:
- staging
changes:
- client/
但是当客户端作业运行时,它将清除服务器文件夹中的node_modules,从而使服务器崩溃。
我想要保留node_modules的方法。或者我可以使用Gitlab CI / CD一起构建服务器和客户端的任何其他方式
答案 0 :(得分:0)
您需要定义每个阶段要保留的文件夹:
select * from products where price + 50 > 20
所有文物将从一个阶段传输到另一个阶段。有关更多信息,请参见https://docs.gitlab.com/ee/ci/yaml/#artifacts