Uploading Artifacts on Travis CI
Travis CI can automatically upload your build artifacts to Amazon S3, after the
after success stage of the
For a minimal configuration, add the following to your
addons: artifacts: true
and add the following environment variables in the repository settings:
ARTIFACTS_KEY=(AWS access key id) ARTIFACTS_SECRET=(AWS secret access key) ARTIFACTS_BUCKET=(S3 bucket name)
The region defaults to
us-east-1. For any other region, either define the
ARTIFACTS_REGION environment variable or add it under the artifacts configuration key:
addons: artifacts: s3_region: "us-west-1" # defaults to "us-east-1"
You can find your AWS Access Keys here.
Deploy specific paths #
The default paths uploaded to S3 are found via
git ls-files -o in
order to find any files in the git working copy that aren’t tracked.
If any additional paths need to be uploaded, they may be specified via
addons.artifacts.paths key like so:
addons: artifacts: # ... paths: - $(git ls-files -o | tr "\n" ":") - $(ls /var/log/*.log | tr "\n" ":") - $HOME/some/other/thing.log
or as an environment variable in repository settings:
# ':'-delimited paths, e.g. ARTIFACTS_PATHS="./logs:./build:/var/log"
Please keep in mind that in the example above, colon (
:) is used as a
delimiter which means file names cannot contain this character.
Working directory #
If you’d like to upload file from a specific directory, you can change your working directory by setting
addons: artifacts: # ... working_dir: out
Target Paths #
By default, artifacts will be uploaded to the path in the bucket
You can change the upload path at build time using the
key, for example:
addons: artifacts: target_paths: - /$TRAVIS_OS_NAME/$((lsb_release -rs 2>/dev/null || sw_vers -productVersion) | grep --only -E '^[0-9]+\.[0-9]+')
If you’d like to see more detail about what the artifacts addon is
addons.artifacts.debug to anything non-empty will turn
on debug logging.
addons: artifacts: # ... debug: true
or define this as a repository settings environment variable, or in the
Travis CI Artifact Uploader #
For more complicated artifact uploads, you can use the Artifact Uploader Tool