2020-05-10 21:57:11 +02:00
|
|
|
# Travis CI
|
|
|
|
|
2022-08-28 21:15:24 +02:00
|
|
|
You may want to set up your project to auto-deploy your new tags on
|
2020-05-10 21:57:11 +02:00
|
|
|
[Travis](https://travis-ci.org), for example:
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
# .travis.yml
|
|
|
|
language: go
|
|
|
|
|
|
|
|
# needed only if you use the snap pipe:
|
|
|
|
addons:
|
|
|
|
apt:
|
|
|
|
packages:
|
|
|
|
- snapcraft
|
|
|
|
|
2021-07-04 00:19:16 +02:00
|
|
|
# needed only if you use the Docker pipe
|
2020-05-10 21:57:11 +02:00
|
|
|
services:
|
|
|
|
- docker
|
|
|
|
|
|
|
|
script:
|
|
|
|
- go test ./... # replace this with your test script
|
2022-04-29 13:11:04 +02:00
|
|
|
- curl -sfL https://goreleaser.com/static/run | bash -s -- check # check goreleaser config for deprecations
|
2020-05-10 21:57:11 +02:00
|
|
|
|
|
|
|
after_success:
|
2021-07-04 00:19:16 +02:00
|
|
|
# Docker login is required if you want to push Docker images.
|
2020-05-10 21:57:11 +02:00
|
|
|
# DOCKER_PASSWORD should be a secret in your .travis.yml configuration.
|
|
|
|
- test -n "$TRAVIS_TAG" && docker login -u=myuser -p="$DOCKER_PASSWORD"
|
|
|
|
# snapcraft login is required if you want to push snapcraft packages to the
|
|
|
|
# store.
|
|
|
|
# You'll need to run `snapcraft export-login snap.login` and
|
|
|
|
# `travis encrypt-file snap.login --add` to add the key to the travis
|
|
|
|
# environment.
|
|
|
|
- test -n "$TRAVIS_TAG" && snapcraft login --with snap.login
|
|
|
|
|
|
|
|
# calls goreleaser
|
|
|
|
deploy:
|
|
|
|
- provider: script
|
|
|
|
skip_cleanup: true
|
2022-04-29 13:11:04 +02:00
|
|
|
script: curl -sfL https://goreleaser.com/static/run | bash
|
2020-05-10 21:57:11 +02:00
|
|
|
on:
|
|
|
|
tags: true
|
|
|
|
condition: $TRAVIS_OS_NAME = linux
|
|
|
|
```
|
|
|
|
|
|
|
|
Note the last line (`condition: $TRAVIS_OS_NAME = linux`): it is important
|
|
|
|
if you run a build matrix with multiple Go versions and/or multiple OSes. If
|
|
|
|
that's the case you will want to make sure GoReleaser is run just once.
|