Travis CI 将 JAR 部署到 Github master
Travis CI deploy JAR to Github master
参考文献:http://docs.travis-ci.com/user/deployment/ and http://docs.travis-ci.com/user/deployment/releases/
我想将我的 JAR 文件部署到 Github,但我不想每次都创建一个标签。
我知道这不是正确的行为,但如果可能的话我想这样做。
构建过程 运行 很好,但是当我使用这个 travis.yml
文件时:
language: java
deploy:
provider: releases
api-key: "<my_api_key>"
file: "teapot-1.2.5-beta.jar"
skip_cleanup: true
on:
branch: master
我收到这个错误:
Installing deploy dependencies
Fetching: addressable-2.3.6.gem (100%)
Successfully installed addressable-2.3.6
Fetching: multipart-post-2.0.0.gem (100%)
Successfully installed multipart-post-2.0.0
Fetching: faraday-0.9.1.gem (100%)
Successfully installed faraday-0.9.1
Fetching: sawyer-0.6.0.gem (100%)
Successfully installed sawyer-0.6.0
Fetching: octokit-3.7.0.gem (100%)
Successfully installed octokit-3.7.0
5 gems installed
Fetching: mime-types-2.4.3.gem (100%)
Successfully installed mime-types-2.4.3
1 gem installed dpl.2
Preparing deploy
Logged in as Carlos Magno Oliveira de Abreu
Deploying to repo: icemagno/teapot
Current tag is: dpl.3
Deploying application
/home/travis/.rvm/gems/ruby-1.9.3-p551/gems/octokit-3.7.0/lib/octokit/response/raise_error.rb:16:in `on_complete': POST https://api.github.com/repos/icemagno/teapot/releases: 422 - Validation Failed (Octokit::UnprocessableEntity)
Error summary:
resource: Release
code: missing_field
field: tag_name
resource: Release
code: custom
field: tag_name
message: tag_name is not well-formed
resource: Release
code: custom
message: Published releases must have a valid tag // See: https://developer.github.com/v3/repos/releases/#create-a-release
...
failed to deploy
这是基本部署配置:
language: java
deploy:
provider: releases
api-key: "<my_key_again>"
file: "teapot-1.2.5-beta.jar"
skip_cleanup: true
on:
tags: true
all_branches: true
但是我还没有创建任何标签,因为我暂时不想这样做。
编辑
我已经创建了一个标签,现在我需要更改 .travis.yml
文件来测试一些配置并且 GitHub 不允许我更改标签文件上的任何内容(好的,必须这样) cr#p !
如果可以的话,我相信你要找的和一样。
基本上将如下内容添加到您的 .travis.yml
:
before_deploy:
- git config --global user.email "builds@travis-ci.com"
- git config --global user.name "Travis CI"
- export GIT_TAG=$TRAVIS_BRANCH-v0.1.$TRAVIS_BUILD_NUMBER
- git tag $GIT_TAG -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER"
- git push -q https://<your-api-key>@github.com/<your_name>/<project_name> --tags
deploy:
skip_cleanup: true
provider: releases
api_key:
secure: [redacted]
file:
- "your_file"
on:
tags: false
all_branches: true
branches:
except:
- /^*-v[0-9]/
尽管这样做要小心,因为在使用这些特定配置选项时搞砸可能会导致无限的 Travis-CI 构建循环,这会污染您的构建和标记历史记录,并且不容易清理.
参考文献:http://docs.travis-ci.com/user/deployment/ and http://docs.travis-ci.com/user/deployment/releases/
我想将我的 JAR 文件部署到 Github,但我不想每次都创建一个标签。 我知道这不是正确的行为,但如果可能的话我想这样做。
构建过程 运行 很好,但是当我使用这个 travis.yml
文件时:
language: java
deploy:
provider: releases
api-key: "<my_api_key>"
file: "teapot-1.2.5-beta.jar"
skip_cleanup: true
on:
branch: master
我收到这个错误:
Installing deploy dependencies
Fetching: addressable-2.3.6.gem (100%)
Successfully installed addressable-2.3.6
Fetching: multipart-post-2.0.0.gem (100%)
Successfully installed multipart-post-2.0.0
Fetching: faraday-0.9.1.gem (100%)
Successfully installed faraday-0.9.1
Fetching: sawyer-0.6.0.gem (100%)
Successfully installed sawyer-0.6.0
Fetching: octokit-3.7.0.gem (100%)
Successfully installed octokit-3.7.0
5 gems installed
Fetching: mime-types-2.4.3.gem (100%)
Successfully installed mime-types-2.4.3
1 gem installed dpl.2
Preparing deploy
Logged in as Carlos Magno Oliveira de Abreu
Deploying to repo: icemagno/teapot
Current tag is: dpl.3
Deploying application
/home/travis/.rvm/gems/ruby-1.9.3-p551/gems/octokit-3.7.0/lib/octokit/response/raise_error.rb:16:in `on_complete': POST https://api.github.com/repos/icemagno/teapot/releases: 422 - Validation Failed (Octokit::UnprocessableEntity)
Error summary:
resource: Release
code: missing_field
field: tag_name
resource: Release
code: custom
field: tag_name
message: tag_name is not well-formed
resource: Release
code: custom
message: Published releases must have a valid tag // See: https://developer.github.com/v3/repos/releases/#create-a-release
...
failed to deploy
这是基本部署配置:
language: java
deploy:
provider: releases
api-key: "<my_key_again>"
file: "teapot-1.2.5-beta.jar"
skip_cleanup: true
on:
tags: true
all_branches: true
但是我还没有创建任何标签,因为我暂时不想这样做。
编辑
我已经创建了一个标签,现在我需要更改 .travis.yml
文件来测试一些配置并且 GitHub 不允许我更改标签文件上的任何内容(好的,必须这样) cr#p !
如果可以的话,我相信你要找的和
基本上将如下内容添加到您的 .travis.yml
:
before_deploy:
- git config --global user.email "builds@travis-ci.com"
- git config --global user.name "Travis CI"
- export GIT_TAG=$TRAVIS_BRANCH-v0.1.$TRAVIS_BUILD_NUMBER
- git tag $GIT_TAG -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER"
- git push -q https://<your-api-key>@github.com/<your_name>/<project_name> --tags
deploy:
skip_cleanup: true
provider: releases
api_key:
secure: [redacted]
file:
- "your_file"
on:
tags: false
all_branches: true
branches:
except:
- /^*-v[0-9]/
尽管这样做要小心,因为在使用这些特定配置选项时搞砸可能会导致无限的 Travis-CI 构建循环,这会污染您的构建和标记历史记录,并且不容易清理.