我在github中有一个R包,我想确保master分支中的每个提交都可以在Travis上成功构建。因此,尽管我只在“ dev”分支上工作,但每次提交时,让travis建立并在成功后推送到master分支。但是,我是没有成功的人。我尝试了多种方法(this,this,this,this和this),但所有方法都失败了。
[为了获得更多上下文,我还希望Travis将一个由jekyll生成的网站部署到gh-pages分支(如果我按下master,它现在可以正确运行)。
如何完成?
默认情况下,Travis CI根据master分支上的提交更改将其推送到GitHub repo gh-pages分支。这就是您由jekyll生成的网站能够推入gh-pages分支的原因。
在您的情况下,您希望Travis CI根据dev分支上的提交更改将其推送到GitHub repo master分支。
这需要在。travis.yml中执行以下Travis CI配置:
language: r
...
...
...
deploy:
provider: pages
skip_cleanup: true
keep_history: true
github_token: $github_token # Your GitHub token set in Travis CI console
target_branch: master # Push into GitHub repo master branch
on:
branch: dev # Your GitHub repo default branch