# 项目的.drone.yml 文件 kind: pipeline # 定义一个管道 type: docker # 定义管道类型 name: default # 定义管道名称 volumes: - name: node_modules # 数据卷名称 # Host Volume, 挂载到宿主机上的卷轴 host: # 宿主机的绝对路径 path: /home/drone/cache/blog/node_modules steps: - name: public-npm # 步骤名称 image: node:12.22.5 # 使用镜像和版本 environment: NPM: from_secret: npm commands: - pwd # 查看当前目录 `/drone/src` - ls -alt - npm config set registry https://registry.npmjs.org # 切换官方仓库 - npm config set -- $NPM # 切换官方仓库 - npm publish --access public # 发布 when: event: tag - name: public-dllcnx # 步骤名称 image: node:12.22.5 # 使用镜像和版本 environment: DLLCNX_NPM: from_secret: dllcnx_npm DLLCNX_NPM_URL: from_secret: dllcnx_npm_urls commands: - pwd # 查看当前目录 `/drone/src` - ls -alt - npm config set registry $DLLCNX_NPM_URL # 切换私有仓库 - npm config set -- $DLLCNX_NPM # 切换私有仓库 - npm publish # 发布 when: event: tag - name: deploy-project image: appleboy/drone-scp settings: host: from_secret: host username: from_secret: username password: from_secret: password port: from_secret: port target: /docker/www/public/deploy source: ./* when: event: tag