Skip to content

Commit ceab69e

Browse files
authored
Merge pull request #597 from gravyboat/gh-pages
Add after_success and branch examples (#1)
2 parents 01ee026 + 18cf595 commit ceab69e

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+
To push a particular branch of your repository to a remote registry,
143+
use the `after_success` section of your `.travis.yml`:
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)