This repository has been archived by the owner on May 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
83 lines (73 loc) · 5.15 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
os: linux
dist: xenial
language: java
jdk:
- openjdk11
env:
global:
- PACKAGE_BUILD_IMAGE=sorintdev/rpmbuild-centos7
- WORKSPACE='/project'
- DIST=rhel7
- secure: bNHHM7oyp9rDyGCJXv7mg8alT+BzxpKkuCQPwOyHXUTGbaxXq8UA+ONzSDeUoLq0B0B/+s75il/F83ZWOluXjXgFJZoBe6NMplCiZLBNi46gAFPmondwNTkPpXiWOQLxti+ut9poNCoeVRSkB2U/27W2kaYXVii/TryN23l1vsaFk1Dr/7XUWk08kEwrBmr/yGfeAwQIOClhrKoCIqJxSKz8EvDzsmaDyEtmyl0daJ2EG8HcrG5XPgVme+s6OhA+piH1cWKJInA0bFoUf4Gvh11oqlBsXw3aK7Mx4qQkpq5Uz7ipWiKMqysNGTJmW224TBAi18wuhQzIktd+/D6Na3n4BjEW/by5DT0KlcgGULh7vbLIpR8am4VghabIYFhroDFvYz0rikfYZ5HvLkUymUuAanDR+D/QdO+T8s8fl/8YhNE/r9bhNhO6+4AB2VOINw/e8Olx7JEjH5U8E57tu45mSNaUxfwN9ijyHL84X/B+kxdMLQS6NQrUHMO6NkMb2J/I5gtYv0Kd0BcEDhssEnSEzxQexoZ60Zg8jD8rnXRv9rWqeA8XxryXeelmKCv1d398wZDWl15JXFnf+iIqSpHl5Ra1txQe4T7XjtgEc7J5pomNq3TM80xmqe/lMCpa6Xnskfl1NxynIeVMDozber2amIIbeCnXnTr33DCz7l8=
- secure: Y6g93aDymkPP6/WQ6/J1JXXGPBj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3RcJXhimmSrmTWT1n2dvCy5U9CmXW4sAIhZVF/FWFJvIpOujxJ/l/6pCiHjdbhQGwlduaA/q1eZO71MAADz+WR91NhTxiM7boJweK68lzRjQHQ2RWYLA6CfENn1/KlUbpXGkPI7Vu2YpYD0yqAzDitzKiGC61Q5oErpy+cBjIeEncMRCPBCqftFk7p2u3Ry3W2d3nFIVDVzAIzl9M5AhJlQvP2ajP7Mb6DsnXlb8hP5YvkPEJVkbShCHdg8SH0oVgN4/NJ2j7ZEM=
branches:
except:
- /^latest$/
services:
- docker
sudo: required
before_install:
- sudo docker pull ${PACKAGE_BUILD_IMAGE}
- if [ -z ${TRAVIS_TAG} ] || [[ ${TRAVIS_TAG} == *-* ]]; then export VERSION=latest; else export VERSION=${TRAVIS_TAG}; fi
- echo ${TRAVIS_TAG}
- echo ${VERSION}
install:
- sudo docker run -d --rm -it -e WORKSPACE="${WORKSPACE}" -e TRAVIS_REPO_SLUG="${TRAVIS_REPO_SLUG}" -e TRAVIS_BUILD_NUMBER="${TRAVIS_BUILD_NUMBER}" -v $PWD:"${WORKSPACE}" --name package_builder ${PACKAGE_BUILD_IMAGE} /bin/cat
script:
- sed -i "s/^\t<version>.*<\/version>/\t<version>${VERSION}<\/version>/" pom.xml
- if [ -z ${TRAVIS_TAG} ] || [[ ${TRAVIS_TAG} == *-* ]]; then sed -ri 's/<([^/]*)\.version>.*<\/\1.version>/<\1.version>latest<\/\1.version>/' pom.xml; fi
- mkdir dist
- mvn clean package 2>&1 > dist/ercole-server-${VERSION}-build-log.txt
- cp target/ercole-server-*.jar dist/
- find target > dist/ercole-server-${VERSION}-target-lists.txt
- sed -i "s|ERCOLE_VERSION|${VERSION}|g" package/rhel7/ercole-server.spec
- docker exec -it package_builder /bin/sh -c "mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}"
- docker exec -it package_builder /bin/sh -c "ln -s ${WORKSPACE} ~/rpmbuild/SOURCES/ercole-server-${VERSION}"
- docker exec -it package_builder /bin/sh -c "cd ${WORKSPACE} && rpmbuild -bb package/${DIST}/ercole-server.spec"
- docker exec -it package_builder /bin/sh -c "cd ${WORKSPACE} && cp ~/rpmbuild/RPMS/x86_64/ercole-server-${VERSION}-1.el*.x86_64.rpm dist/"
- sudo chmod -R a+rwx .
- ls -al target
- whoami
- ls target/ercole-server-*.*
- docker build -t ercole/ercole-server:latest .
- if [ ! -z ${TRAVIS_TAG} ] && [[ ! ${TRAVIS_TAG} == *-* ]]; then docker tag ercole/ercole-server:latest ercole/ercole-server:${VERSION}; fi
- if [ ! -z ${TRAVIS_TAG} ] && [[ ! ${TRAVIS_TAG} == *-* ]]; then docker tag ercole/ercole-server:latest ercole/ercole-server:latest-stable; fi
after_failure:
- find .
- docker exec -it package_builder /bin/sh -c "find ~/rpmbuild"
- cat dist/ercole-server-${VERSION}-build-log.txt | tail -n 300
before_deploy:
- if [[ ${VERSION} == "latest" ]]; then git tag -f latest; fi
- if [[ ${VERSION} == "latest" ]]; then git remote add gh https://simonerota:${GITHUB_RELEASE_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git; fi
- if [[ ${VERSION} == "latest" ]]; then git push gh latest || true; fi
- if [[ ${VERSION} == "latest" ]]; then git push -f gh latest; fi
- if [[ ${VERSION} == "latest" ]]; then git remote remove gh; fi
- if [[ ${VERSION} == "latest" ]]; then export RELEASE_NAME=latest; else export RELEASE_NAME=${VERSION}; fi
deploy:
- deploy:
provider: releases
api_key: $GITHUB_RELEASE_TOKEN
file_glob: true
file: dist/*
skip_cleanup: true
name: $RELEASE_NAME
overwrite: true
on:
all_branches: true
- provider: script
skip_cleanup: true
script: script/docker-deploy.sh
on:
jdk: openjdk11
repo: ercole-io/ercole-server