Skip to content

Commit 70e8e76

Browse files
committed
Add after_success and branch examples (#1)
* Add after_success and branch examples * Remove a comment
1 parent 5d34347 commit 70e8e76

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

user/docker.md

+14
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,20 @@ Within your `.travis.yml` prior to attempting a `docker push` or perhaps before
137137
docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
138138
```
139139

140+
#### Branch Based Registry Pushes
141+
142+
Using `after_success` it is also possible to push an image to a registry based
143+
on the branch:
144+
145+
```yaml
146+
147+
after_success:
148+
- if [ "$TRAVIS_BRANCH" == "master" ]; then
149+
docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
150+
docker push USER/REPO;
151+
fi
152+
```
153+
140154
#### Private Registry Login
141155

142156
When pushing to a private registry, be sure to specify the hostname in the

0 commit comments

Comments
 (0)