-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
101 lines (87 loc) · 2.69 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
sudo: required
language: bash
dist: trusty
services:
- docker
# Don't build release tags. This avoids publish conflicts because the version commit exists both on master and the release tag.
# See https://github.com/travis-ci/travis-ci/issues/1532
branches:
except:
- /^[0-9]/
# safelist
only:
- master
- develop
- release
# before install any component
before_install:
# Parameters used during release
- git config user.name "$GH_USER"
- git config user.email "$GH_USER_EMAIL"
# setup https authentication credentials, used by ./mvnw release:prepare
- git config credential.helper "store --file=.git/credentials"
- echo "https://$GH_TOKEN:@github.com" > .git/credentials
before_script:
- env | sort
- IMAGE_NAME=clamav-server
- IMAGE_BASE="${ACCOUNT_ID:-djantaio}/${IMAGE_NAME}"
- IMAGE_TAG="${IMAGE_BASE}"
- IMAGE_BRANCH="${IMAGE_BASE}:${TRAVIS_BRANCH}"
# Making sure we login ...
- echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USER" --password-stdin
after_script:
- docker images
- docker ps -a
# Expected stage definition
stages:
- name: develop
if: (branch = develop AND type != pull_request) AND commit_message !~ /^(prepare release ([0-9\.]+))$/
- name: snapshot
if: branch = master AND type != pull_request AND commit_message !~ /^(prepare release ([0-9\.]+))$/
- name: release
if: ((tag =~ /^[0-9\.]+$/ OR $TRAVIS_TAG =~ /^[0-9\.]+$/) OR $TRAVIS_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/ OR $TRAVIS_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/)
# Build job configuration
jobs:
include:
- stage: develop
name: "Build and Unit Testing the develop & PR branch"
install: true
before_deploy:
- docker tag "$IMAGE_TAG" "$IMAGE_BRANCH"
script:
- docker --debug build -t "$IMAGE_TAG" .
deploy:
provider: script
script: docker push "$IMAGE_BRANCH"
on:
branch: develop
- stage: snapshot
name: "Deploy Snapshot to Maven repo"
install: true
script:
- echo "Not Yet Implemented ..."
- stage: release
name: "Release the latest tag to docker registry"
install: true
script:
- echo "Not Yet Implemented ..."
#after_success:
# # Only continue for 'develop' or 'release/*' branches
# - if [ "$TRAVIS_BRANCH" =~ "^(develop$|feature//*)" ]; then
# docker --debug build -t "$IMAGE_TAG" .
# docker push "${IMAGE_BRANCH}";
# fi
#notifications:
# email: false
# slack:
# rooms:
# on_success: always
# on_failure: always
# template:
# - Build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>) of %{repository}@%{branch}
# by %{author} %{result} in %{duration}
# webhooks:
# urls:
# on_success: change
# on_failure: always
# on_start: never