stages: # 分段
- install
- build
- deploy-sit
- deploy-prod
cache: # 缓存
paths:
- node_modules
- dist
install-job:
tags:
- sit
only:
- sit
- prod
stage: install
script:
- cnpm install
build-job:
tags:
- sit
only:
- sit
- prod
stage: build
script:
- npm run build
deploy-sit-job:
tags:
- sit
only:
- sit
stage: deploy-sit
script:
- sshpass -p $PASSWORD scp -r ./dist/* $USER_NAME@$IP:/root/backend-cicd/app/public
deploy-prod-job:
tags:
- sit
only:
- prod
stage: deploy-prod
script:
- sshpass -p $PASSWORD scp -r ./dist/* $USER_NAME@$IP:/root/backend-cicd/app/public