-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
68 lines (68 loc) · 2.78 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
matrix:
include:
- language: go # Build and Test
go:
- 1.13.x
sudo: true
# Derived from https://github.com/lib/pq/blob/master/.travis.yml
env:
- GO111MODULE=on
- FBM_DB_CONN=postgres://fbm:[email protected]/fbm
- PGVERSION=12
script:
- ./travis/before_install.bash
- ./travis/before_script.bash
- ./travis/script.bash
after_success:
- bash <(curl -s https://codecov.io/bash)
- language: minimal # Build on master
env:
- REGISTRY=docker.pkg.github.com/bitmark-inc/spring-app-api
services:
- docker
if: branch = master AND fork = false
before_script:
- export VERSION="commit-$(git rev-parse --short ${TRAVIS_COMMIT})"
- echo "$GITHUB_TOKEN" | docker login docker.pkg.github.com -u "$DOCKER_USERNAME" --password-stdin # Login to GitHub Registry using Travis environment variables
script:
- docker build --build-arg dist=$VERSION -t $REGISTRY/api:$VERSION . || { echo 'build failed' ; exit 1; }
- docker build --build-arg dist=$VERSION -t $REGISTRY/background:$VERSION -f Dockerfile-Jobs . || { echo 'build failed' ; exit 1; }
after_success:
- docker push $REGISTRY/api:$VERSION
- docker push $REGISTRY/background:$VERSION
- language: generic # Build on tag
env:
- REGISTRY=docker.pkg.github.com/bitmark-inc/spring-app-api
services:
- docker
if: tag IS present
before_script:
- echo "$GITHUB_TOKEN" | docker login docker.pkg.github.com -u "$DOCKER_USERNAME" --password-stdin # Login to GitHub Registry using Travis environment variables
- export API_DOCKER_IMG=$REGISTRY/api:$TRAVIS_TAG
- export BACKGROUND_DOCKER_IMG=$REGISTRY/background:$TRAVIS_TAG
- export RELEASE_NAME=v$TRAVIS_TAG
- export RELEASE_BODY=`cat ./travis/release_template.md | sed -e 's@SPRING_VERSION@'"$TRAVIS_TAG"'@g'`
script:
- docker build --build-arg dist=$TRAVIS_TAG -t $API_DOCKER_IMG . || { echo 'build failed' ; exit 1; }
- docker build --build-arg dist=$TRAVIS_TAG -t $BACKGROUND_DOCKER_IMG -f Dockerfile-Jobs . || { echo 'build failed' ; exit 1; }
after_success:
- docker push $API_DOCKER_IMG
- docker push $BACKGROUND_DOCKER_IMG
before_deploy:
- sudo apt-get update
- travis_retry sudo apt-get install -y jshon
- echo $RELEASE_BODY
- export BODY=$(jshon -s "$RELEASE_BODY")
deploy:
provider: releases
api_key: $GITHUB_TOKEN
overwrite: true
skip_cleanup: true
target_commitish: $TRAVIS_COMMIT
tag_name: $TRAVIS_TAG
draft: false
prerelease: true
name: $RELEASE_NAME
body: $BODY
on:
tags: true