Skip to content

Commit

Permalink
Travis: Build and push Docker image to Docker Hub
Browse files Browse the repository at this point in the history
  • Loading branch information
jonashaag authored and Jonas Haag committed Nov 27, 2019
1 parent aecaaac commit 5f63c04
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 11 deletions.
37 changes: 28 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,41 @@
sudo: false
stages:
- test
- deploy


# For tests
os: linux
addons:
apt:
packages:
- exuberant-ctags
language: python
python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
addons:
apt:
packages:
- exuberant-ctags
matrix:
include:
- python: 3.7
dist: xenial
- "3.7"
- "3.8"
- "nightly"
install:
- "pip install ."
- "pip install -r test_requirements.txt"
script:
- git config --global user.email "[email protected]"
- git config --global user.name "Your Name"
- ./runtests.sh


# For deploy
services:
- docker
jobs:
include:
- stage: deploy
script: skip
deploy:
on:
tags: true
provider: script
script: ./build-and-push-docker.sh
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

1.5.0 (Nov 26, 2019)
-------------------
- Test release to check Docker pipeline. No changes.

1.5.0 (Nov 3, 2019)
-------------------
- #239: More robust "last updated at" determination (Jelmer Vernooij)
Expand Down
21 changes: 21 additions & 0 deletions build-and-push-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh -eu

log() {
echo "$@" >&2
}

R=jonashaag/klaus

log "Building klaus==$TRAVIS_TAG"
docker build -t $R:$TRAVIS_TAG --build-arg KLAUS_VERSION=$TRAVIS_TAG .

log "Logging in to Docker Hub"
echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin

log "Pushing to :$TRAVIS_TAG"
docker push $R:$TRAVIS_TAG
if test "$(git tag | grep '^[0-9]' | sort -V | tail -n1)" = "$TRAVIS_TAG"; then
log "Pushing to :latest"
docker tag $R:$TRAVIS_TAG $R:latest
docker push $R:latest
fi
2 changes: 1 addition & 1 deletion klaus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from klaus.repo import FancyRepo, InvalidRepo


KLAUS_VERSION = utils.guess_git_revision() or '1.5.0'
KLAUS_VERSION = utils.guess_git_revision() or '1.5.1'


class Klaus(flask.Flask):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def install_data_files_hack():

setup(
name='klaus',
version='1.5.0',
version='1.5.1',
author='Jonas Haag',
author_email='[email protected]',
packages=['klaus', 'klaus.contrib'],
Expand Down

0 comments on commit 5f63c04

Please sign in to comment.