将build文件夹复制到我的存储库

时间:2017-11-22 20:53:46

标签: node.js docker repository bitbucket bitbucket-pipelines

我有这个bitbucket-pipelines.yml,有没有办法将npm run buid创建的构建复制到我的存储库中?

image: node:6.9.4

pipelines:
  branches:
    master:
      - step:
         caches:
          - node
         script:
          - npm install
          - npm run build

1 个答案:

答案 0 :(得分:1)

如果您的意思是在Bitbucket存储库中将构建保存为下载,那么我们有a guide on how to do it via the Bitbucket API。基本步骤是:

  1. 为资源库所有者创建应用程序密码
  2. 使用身份验证令牌
  3. 创建管道环境变量
  4. 使用curl和Bitbucket REST API将您的工件上传到Bitbucket下载
  5. 有关如何执行此操作的详细信息,请参阅in the guide

    如果您的意思是将构建提交回Git存储库,我们不建议这样做。在Git中存储构建输出并不理想 - 您应该使用BB下载或npm注册表。但是,如果您真的想要,可以按照上面的指南创建应用程序密码,然后将其作为环境变量传递到管道中,将其设置为HTTPS git远程,然后使用git push上传它回到Bitbucket。