Bintray Deployment
This page documents deployments using the dpl v2. Please see our blog post for details. You can check previous dpl v1 documentation here.
Travis CI can automatically upload build artifacts to Bintray after a successful build.
For a minimal configuration, add the following to your .travis.yml:
deploy:
provider: bintray
user: <user>
key: <encrypted key>
file: <file>
edge: true # opt in to dpl v2
Status #
Support for deployments to Bintray is stable.
Known options #
Use the following options to further configure the deployment.
user |
Bintray user — required, type: string |
key |
Bintray API key — required, secret, type: string |
file |
Path to a descriptor file for the Bintray upload — required, type: string |
passphrase |
Passphrase as configured on Bintray (if GPG signing is used) — type: string |
Shared options #
cleanup |
Clean up build artifacts from the Git working directory before the deployment — type: boolean |
run |
Commands to execute after the deployment finished successfully — type: string or array of strings |
Environment variables #
All options can be given as environment variables if prefixed with BINTRAY_.
For example, key can be given as BINTRAY_KEY=<key>.
Securing secrets #
Secret option values should be given as either encrypted strings in your build
configuration (.travis.yml file) or environment variables in your repository
settings.
Environment variables can be set on the settings page of your repository, or
using travis env set:
travis env set BINTRAY_KEY <key>
In order to encrypt option values when adding them to your .travis.yml file
use travis encrypt:
travis encrypt <key>
Or use --add to directly add it to your .travis.yml file. Note that this command has to be run in your repository’s root directory:
travis encrypt --add deploy.key <key>
Descriptor File #
The descriptor is in JSON file format in three sections:
{
"package": {
"name": "auto-upload",
"repo": "myRepo",
"subject": "myBintrayUser",
"desc": "I was pushed completely automatically",
"website_url": "www.jfrog.com",
"issue_tracker_url": "https://github.com/bintray/bintray-client-java/issues",
"vcs_url": "https://github.com/bintray/bintray-client-java.git",
"github_use_tag_release_notes": true,
"github_release_notes_file": "RELEASE.txt",
"licenses": ["MIT"],
"labels": ["cool", "awesome", "gorilla"],
"public_download_numbers": false,
"public_stats": false,
"attributes": [
{ "name": "att1", "values" : ["val1"], "type": "string" },
{ "name": "att2", "values" : [1, 2.2, 4], "type": "number" },
{ "name": "att5", "values" : ["2014-12-28T19:43:37+0100"], "type": "date" }
]
},
"version": {
"name": "0.5",
"desc": "This is a version",
"released": "2015-01-04",
"vcs_tag": "0.5",
"attributes": [
{ "name": "VerAtt1", "values" : ["VerVal1"], "type": "string" },
{ "name": "VerAtt2", "values" : [1, 3.3, 5], "type": "number" },
{ "name": "VerAtt3", "values" : ["2015-01-01T19:43:37+0100"], "type": "date" }
],
"gpgSign": false
},
"files": [
{
"includePattern": "build/bin(.*)*/(.*\\.gem)",
"excludePattern": ".*/do-not-deploy/.*",
"uploadPattern": "gems/$2"
},
{
"includePattern": "build/docs/(.*)",
"uploadPattern": "docs/$1",
"listInDownloads": true
}
],
"publish": true
}
Package Section #
Bintray package information. The following information is mandatory for open-source projects:
nameis the Bintray package name.repois the Bintray repository name.subjectis the Bintray subject, which is either a user or an organization.vcs_urlis the Bintray version control system URL, such as a GitHub repository URL.licensesis the Bintray licences, which is a list with at least one item.
Version Section #
Package version information. In case the version already exists on Bintray, only the name field is mandatory.
Files Section #
Configure the files you want to upload to Bintray and their upload path.
You can define one or more groups of patterns. Each group contains three patterns:
includePattern: Pattern in the form of Ruby regular expression, indicating the path of files to be uploaded to Bintray. If files are in your root directory, indicate a relative path :\./excludePattern: Optional. Pattern in the form of Ruby regular expression, indicating the path of files to be removed from the list of files specified by the includePattern.uploadPattern: Upload path on Bintray. The path can contain symbols in the form of $1, $2,… that are replaced with capturing groups defined in the include pattern.
If listInDownloads is set to true matching artifacts will appear in the
“Download list” or “Direct downloads”. This can be done only on published
versions, so publish should be set to true.
In the example above, the following files are uploaded:
- All gem files located under
build/bin/(including sub directories), except for files under ado-not-deploydirectory. The files will be uploaded to Bintray under thegemsfolder. - All files under
build/docs. The files will be uploaded to Bintray under thedocsfolder, and will appear in the downloads list of the project overview.
Regular expressions defined as part of the
includePatternandexcludePatternproperties must be wrapped with brackets.
Debian Upload #
When artifacts are uploaded to a Debian repository on Bintray using the Automatic index layout, the Debian distribution information is required and must be specified. The information is specified in the descriptor file by the matrixParams as part of the files closure as shown in the following example:
uploadPattern should respect bintray automatic layout scheme.
"files": [
{
"includePattern": "build/bin/(.*\.deb)",
"uploadPattern": "pool/main/m/mypackage/$1",
"matrixParams": {
"deb_distribution": "vivid",
"deb_component": "main",
"deb_architecture": "amd64"
}
}
]
Overwrite Existing Files #
If an artifact by a given name already exists in the Bintray repository, then
by default it is not overwritten. If you want to replace the existing file,
define the override key in your matrix properties:
"files": [
{
"includePattern": "build/bin/(myfile.bin)",
"uploadPattern": "$1",
"matrixParams": {
"override": 1
}
}
]
Pull Requests #
Note that pull request builds skip the deployment step altogether.