代码之家  ›  专栏  ›  技术社区  ›  bess

如何在特拉维斯自动升级宝石?

  •  1
  • bess  · 技术社区  · 8 年前

    我帮助维持 an open source project ,Hyrax,这是一个轨道发动机。为了对新的开发进行质量保证,我们保持 an application that is specifically for QA ,Nurax,它应该始终使用最新的rails引擎主版本进行更新。我已经在 Gemfile 为了努拉克斯,如果我跑 bundle update hyrax 它将获得最新的主版本并更新 Gemfile.lock 因此。我也可以让Nurax通过Travis自动部署。但是,在部署之前,自动部署不会自动更新到Hyrax的最新版本,这是我真正想要的。

    最好的方法是什么?我应该让特拉维斯 包更新hyrax 把这些改变作为建造的一部分交给努拉克斯大师?我发现了一些关于从travis构建提交的主题(例如。, this one ). 最好为每个公关建立一个新的Nurax分支,并部署该分支?有没有一个我可以遵循的既定模式?

    任何建议都非常感谢。

    1 回复  |  直到 8 年前
        1
  •  0
  •   bess    7 年前

    我最后用一个亲信解决了这个问题。我在有问题的服务器上的主目录中签出了代码的本地副本 ubuntu 用户。然后我添加了 乌班图 用户的ssh密钥到我自己的github帐户,以及用于capistrano部署的帐户。然后,我将此设置为每天运行:

    #!/usr/local/bin/ruby
    
    # Get the latest nurax master
    # Make a branch with today's date and update hyrax
    # Push and deploy that branch
    
    today = Time.now.strftime('%Y-%m-%e-%H-%M')
    `cd /home/ubuntu/nurax; git checkout master; git pull; git checkout -b "#{today}"`
    `cd /home/ubuntu/nurax; bundle update hyrax`
    `cd /home/ubuntu/nurax; git commit -a -m 'Daily update for "#{today}"'; git push --set-upstream origin #{today}`
    `cd /home/ubuntu/nurax; BRANCH_NAME="#{today}" cap nurax-dev deploy`
    `cd /home/ubuntu/nurax; git checkout master; git branch -d "#{today}"; git push origin --delete "#{today}"`