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.
Travis CI can automatically upload and release your app to the Snap Store after a successful build.
For a minimal configuration, add the following to your
deploy: provider: snap token: <encrypted token> edge: true # opt in to dpl v2
snap value should be a string that matches exactly one file when the
deployment starts. If the name of the snap file is not known ahead of time,
you can use a shell glob pattern, e.g.
Support for deployments to Snap is *stable**.
Known options #
Use the following options to further configure the deployment.
||Snap API token — required, secret, type: string|
||Path to the snap to be pushed (can be a glob) — type: string, default:
||Channel into which the snap will be released — type: string, default:
Shared options #
||Clean up build artifacts from the Git working directory before the deployment — type: boolean|
||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
token can be given as
Securing secrets #
Secret option values should be given as either encrypted strings in your build
.travis.yml file) or environment variables in your repository
Environment variables can be set on the settings page of your repository, or
travis env set:
travis env set SNAP_TOKEN <token>
In order to encrypt option values when adding them to your
travis encrypt <token>
--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>
Obtaining credentials #
If you have not done so already, enable snap support on your system.
sudo snap install snapcraft --classic
Login tokens can specify how, when, and where they can be used, thus minimising damage from compromise.
Export a token that can only upload this snap to the channel you are going to
upload to (in this example,
snapcraft export-login --snaps my-snap-name --channels edge -
The token will be printed out.
Note: The final
-requests the login be exported to stdout instead of a file. It is required.
edgechannel is intended for the bleeding edge: your every commit to master will be built and uploaded.
Using uploaded Snaps #
Your community of early-adopters and testers can install your app in any of the supported Linux distributions with:
sudo snap install my-snap-name --edge
Each upload gets a monotonically increasing integer. When you’re ready, you can release one of these built commits to the stable channel for public discovery in the Snap storefront. For example, you could promote the very first upload to stable:
snapcraft release my-snap-name 1 stable
Pull Requests #
Note that pull request builds skip the deployment step altogether.