提交主文档后,我想使用Travis在Github Releases中创建漂亮的帖子
这就是我需要的:
我尽力了,但是我只能将二进制文件添加到发行版中。这是我的配置:
language: java
sudo: false
install: gradle wrapper --gradle-version 4.2
jdk:
- oraclejdk8
script:
- chmod +x gradlew
- "./gradlew test"
- "./gradlew build"
- "./gradlew jar"
- cd build # test
- ls
- cd libs
- ls
- pwd
- echo $TRAVIS_BUILD_NUMBER
cache:
directories:
- "$HOME/.gradle"
- ".gradle"
before_deploy:
# Set up git user name and tag this commit
- git config --local user.name "RareScrap"
- git config --local user.email "RareScrap@users.noreply.github.com"
- 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"
deploy:
provider: releases
api_key:
secure: [redacted]
file: "/home/travis/build/RareScrap/travis.test/build/libs/*"
skip_cleanup: true
file_glob: true
on:
repo: RareScrap/travis.test
branches: # ← new! ghjgjghjghjghj
only: # ← new!
- master # ← new!
答案 0 :(得分:2)
GitHub Releases API可以接受:
仅在master
上使用on
而不是only
。
因此,只需添加更改您的部署即可:
deploy:
provider: releases
api_key:
secure: [redacted]
file: "/home/travis/build/RareScrap/travis.test/build/libs/*"
skip_cleanup: true
file_glob: true
on:
repo: RareScrap/travis.test
branches: # ← new! ghjgjghjghjghj
only: # ← new!
- master # ← new!
对此:
deploy:
provider: releases
api_key:
secure: [redacted]
file: "/home/travis/build/RareScrap/travis.test/build/libs/*"
skip_cleanup: true
file_glob: true
on:
repo: RareScrap/travis.test
branch: master
name: $YOUR_RELEASE_NAME
body: $YOUR_RELEASE_CONTENT
在我做过非常相似的事情时,请随时参考my .travis.yml file。
希望这会有所帮助!