travis-ci使用--github-token安装版本

lig*_*igi 9 github travis-ci

我在使用带有github令牌的安装程序版本时遇到问题.我喜欢travis-ci,但我不愿意分发我的github密码 - 我需要使用令牌,我阅读文档,因为这应该是这样的.不幸的是,它仍然要求使用密码:

$ travis login --github-token XXXXXXXXX
Successfully logged in as ligi!

$ travis whoami 
You are ligi (ligi)

$ travis setup releases
Detected repository as ligi/gobandroid, is this correct? |yes| 
Username: 
Run Code Online (Sandbox Code Playgroud)

Jos*_*osh 5

这是一条不涉及在终端中输入您的 GitHub 密码的路线。我假设你已经安装了 travis CI。这假设您正在使用travis-ci.org,但替换--orgwith--com应该可以正常工作。

如果github.com/your/repo是你的回购:

  1. 生成具有以下范围的Github 个人访问令牌read:org, public_repo, repo:status, repo_deployment, user:email, write:repo_hook
  2. (可选?)登录使用 travis login <github token> --org
  3. echo <github token> | travis encrypt --org -r your/repo
  4. .travis.yml如文档中所述,在您的文件中使用该机密

您可能需要提供完整的 repo 范围,但对于 Travis 的免费层,public_repo就足够了。我也不确定其他哪些范围是强制性的。

echo 在 Windows 上很有用,因为 Ctrl-D 在 Powershell 中不能正常工作。


Kon*_*ase 2

Travis CI CLI 不会将 GitHub 密码发送到 Travis CI,而是将其发送到 GitHub 并使用它生成 GitHub 令牌(对于 来说也是如此travis login)。

但是,如果您仍然觉得不舒服,可以手动配置部署。

将以下内容添加到您的 .travis.yml 中:

deploy:
  provider: releases
  api_key: "GITHUB OAUTH TOKEN"
  file: "FILE TO UPLOAD"
  skip_cleanup: true
  on:
    tags: true
    all_branches: true
Run Code Online (Sandbox Code Playgroud)

您可以通过 加密 GitHub OAuth 令牌travis encrypt ...。为此,无需通过 CLI 登录,加密会在本地进行。

请参阅http://docs.travis-ci.com/user/deployment/releases/以获取完整文档