main: push: #导入环境变量:https://docs.cnb.cool/zh/env.html#dao-ru-huan-jing-bian-liang - imports: - https://cnb.cool/examples/secrets/-/blob/main/react_cos_secret.yml #声明构建环境:https://docs.cnb.cool/zh/ docker: image: node:20 #volumes缓存:https://docs.cnb.cool/zh/grammar/pipeline.html#volumes volumes: # 使用缓存,同时更新 - /root/.npm:cow stages: - name: 编译 script: npm install && npm run build - name: 查看目录 script: ls -a - name: tencentcom 上传文件 image: tencentcom/coscli #插件地址: https://docs.cnb.cool/zh/plugins/public/tencentcom/coscli #配置coscli的COS_SECRET_ID、COS_SECRET_KEY、COS_BUCKET、COS_REGION #执行coscli cp将本地的./dist文件夹上传到$COS_BUCKET中 commands: | coscli config set --secret_id $COS_SECRET_ID --secret_key $COS_SECRET_KEY coscli config add --init-skip=true -b $COS_BUCKET -r $COS_REGION coscli cp ./build cos://$COS_BUCKET -r