packagecloud Deployment

This page documents deployments using the next major version dpl v2, which currently is in a beta release phase. Please see our blog post for details. The current default version is dpl v1. Check dpl v1 documentation here.

Be sure to read the v2 deployment overview.

Travis CI can automatically push your RPM, Deb, Deb source, or RubyGem package build artifacts to packagecloud.io after a successful build.

For a minimal configuration, add the following to your .travis.yml:

deploy:
  provider: packagecloud
  username: <username>
  token: <encrypted token>
  repository: <repository>
  edge: true # opt in to dpl v2

Note that your repository name should not have a forward slash in it: For example if your repository appears as username/repo on packagecloud.io, the repository option is repo and the username option is username.

You can retrieve your api token by logging in and visiting the API Token page under Account Settings.

Additionally, for Debian, RPM, and Node.js packages the dist option is required:

  deploy:
    provider: packagecloud
    # ⋮
    dist: <dist> # required for , e.g. 'centos/5'

The list of supported distributions for the dist option can be found here.

Status #

Support for deployments to Packagecloud is in alpha. Please see Maturity Levels for details.

Known options #

Use the following options to further configure the deployment.

username The packagecloud.io username. — required, type: string
token The packagecloud.io api token. — required, secret, type: string
repository The repository to push to. — required, type: string
local_dir The sub-directory of the built assets for deployment. — type: string, default: .
dist Required for debian, rpm, and node.js packages (use “node” for node.js packages). The complete list of supported strings can be found on the packagecloud.io docs. — type: string
force Whether package has to be (re)uploaded / deleted before upload — type: boolean
connect_timeout type: integer, default: 60
read_timeout type: integer, default: 60
write_timeout type: integer, default: 180
package_glob type: string or array of strings, default: ["**/*"]

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 PACKAGECLOUD_.

For example, token can be given as PACKAGECLOUD_TOKEN=<token>.

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 PACKAGECLOUD_TOKEN <token>

In order to encrypt option values when adding them to your .travis.yml file use travis encrypt:

travis encrypt <token>

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.token <token>

Specifying a package folder #

By default, the packagecloud provider will scan the current directory and push all supported packages.

You can specify which directory to scan from with the local_dir option. This example scans from ./build directory.

deploy:
  provider: packagecloud
  # ⋮
  local_dir: build

Alternately, you can specify the package_glob argument to restrict which files to scan. It defaults to **/* (recursively finding all package files) but this may pick up other artifacts you don’t want to release.

For example, if you only want to push gems in the top level directory:

deploy:
  provider: packagecloud
  # ⋮
  package_glob: "*.gem"

A note about Debian source packages #

If the packagecloud provider finds any .dsc files, it will scan it and try to locate it’s contents within the local_dir directory. Ensure the source package and it’s contents are output to the same directory for it to work.

Pull Requests #

Note that pull request builds skip the deployment step altogether.

See also #