-
Notifications
You must be signed in to change notification settings - Fork 57
/
.travis.yml
75 lines (67 loc) · 3.97 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
sudo: required
services:
- docker
language: go
go:
- 1.9
env:
matrix:
- OKARCH=amd64 OSARCH=amd64
- OKARCH=386 OSARCH=i386
global:
- VERSION=${TRAVIS_TAG}
- GH_USER=${TRAVIS_REPO_SLUG%/*}
- GH_APP=${TRAVIS_REPO_SLUG#*/}
- JFROG_CLI_OFFER_CONFIG=false
# bintray token
- secure: IRw6MHgW2lWOTywZVxn9rF5Sp91Iji/XJNT1dGs/gCogEojzE84K8OlWmPb090cGmJR+wv5wp0be5G34qYV0vssxseOVRZ4JZN0EqOOQGSPZxrbVc1aXMv4JKfe8SlBh18IG6O2bZW1uQHCpBz1QSygzG7o7wD1/j7q83PMxy4IMzfRNcbjRUmqK10/TMiDUuPTYXIAi5RKgrIghvfaIvtl3DG++BquhfYKex5u98kTcLDJ2eHTfWsl7UMcvHDamYVIDt5WFfPidfkkG8BXD5bwjgldGZ7CiXPevrslKeE5ZV3cjBRvSxcnGGOEE/hN9hhCiVCz/YJIc6v9QoTIRG9nv9RulCBAHsZJZXa3NymERioMi/+b5H7J3hluRSPpGHsGCefygi3lL7mq4lPhZAd78Rq6gkEG10sNcRjiP3nCsSFlTWIMyZmiTy27FvV9C8rCihAg0vMdx/mA0AWLDLjAvzSeNJAOiV6pXTDVIZVTiE82cTyqV9YrKZ9E7cxJz9mOfBEZ1AT5SRw6hFsQ7g+cPvscpL0l10S5WinfmGJzu+vjJ9RzYETSRrO1PUiOk4puyjW+AQmFy7CjL7lS7fL8xGsx3xENq1FW1NhRFP22jwA0wcWjXlDCRYzCLbuDBRfSasFZCQKEUTeOuvplTA/Yx62Es36TtgGKIwwYk+1U=
before_install:
- sudo add-apt-repository 'deb https://dl.bintray.com/mh-cbon/deb unstable main'
- sudo apt-get -qq update
- sudo apt-get install --allow-unauthenticated changelog go-bin-deb fakeroot
- mkdir -p ${GOPATH}/bin
- cd ~
- curl https://glide.sh/get | sh
install:
- cd $GOPATH/src/github.com/$TRAVIS_REPO_SLUG
- glide install
- go install
script:
- echo "pass, ok."
before_deploy:
# create the deb package
- cd $GOPATH/src/github.com/$TRAVIS_REPO_SLUG
- mkdir -p build/$OSARCH
- GOOS=linux go build --ldflags "-X main.VERSION=$VERSION" -o build/$OSARCH/$GH_APP main.go
- go-bin-deb generate --file deb.json -a $OSARCH --version $VERSION -o $GH_APP-$OSARCH-$VERSION.deb
# copy the deb for gh release (backward compatibility)
- cp $GH_APP-$OSARCH-$VERSION.deb $GH_APP-$OKARCH.deb
# upload to bintray
- curl -fL https://getcli.jfrog.io | sh
- ls -alh
- ./jfrog bt pc --key=$BTKEY --user=$GH_USER --licenses=MIT --vcs-url=https://github.com/$GH_USER/deb $GH_USER/deb/$GH_APP || echo "package already exists"
- ./jfrog bt upload --override=true --key $BTKEY --publish=true --deb=unstable/main/$OSARCH $GH_APP-$OSARCH-$VERSION.deb $GH_USER/deb/$GH_APP/$VERSION pool/g/$GH_APP/
# prepare rpm package creation
- docker pull fedora
# create the package in the docker
- >
docker run -v $PWD:/mnt/travis fedora /bin/sh -c
"cd /mnt/travis && (curl -s -L https://bintray.com/mh-cbon/rpm/rpm > /etc/yum.repos.d/w.repo) && dnf install go-bin-rpm changelog rpm-build -y --quiet && go-bin-rpm generate --file rpm.json -a $OSARCH --version $VERSION -o $GH_APP-$OSARCH-$VERSION.rpm"
# copy the rpm for gh release (backward compatibility)
- cp $GH_APP-$OSARCH-$VERSION.rpm $GH_APP-$OKARCH.rpm
# upload to bintray
- ./jfrog bt pc --key=$BTKEY --user=$GH_USER --licenses=MIT --vcs-url=https://github.com/$GH_USER/rpm $GH_USER/rpm/$GH_APP || echo "package already exists"
- ./jfrog bt upload --override=true --key $BTKEY --publish=true $GH_APP-$OSARCH-$VERSION.rpm $GH_USER/rpm/$GH_APP/$VERSION pool/$POOL/$GH_APP/
# generate the repo metadata
- curl -X POST -u ${GH_USER}:${BTKEY} https://api.bintray.com/calc_metadata/${GH_USER}/rpm
deploy:
provider: releases
api_key:
secure: Dmi4to/C++oBkvIX2Q+hYvUkikb3au3T0jbhXDgl3WxCaz//TX28TJNzjYU/kR0etXGuQCwafPd8rUcWnz02X9ZUN2PG0Vx28BmOmQ3n7+1EDEkRTOP5e6vI6ZUSeti/YYsNjPLiw4UpQYcCIVCp07Cw4MlNfS/8IL5gcfnsQWU+YiBxG8zp6v6oz8utBpqa2Ax6JZ5aELoOiO7s11LB2M8VwbE3/drwz0ztEpAkocIGIq5zgG2SuG3yPKqA80Pimu/k96qxxlLy/ZBE+EYWz2JFaN88V9RO01l7ccYesENeYABK+iU0bI88UTFfY+QAU71zPB75u1dQpEP5K2u3OseaUhq59YObKBHKl6Z6mPb61SbdTeEokf2XEPBN3RTHPPKIYezxYKCavjGXkAXTQAR5FBZdvGZk04Kxw5jT13X+UzTxeo9gSkQGng4JgSIO4M1wJT+gPezbxYF7huIFFMGKUaCDy60PU0gN7HuDjkdcFwjdYfk5BQkeoaI8sUTp4fhHtjXjiVU8opk+LPIYd7muAV3tNtQz14P+0zQlceRimP2hAklVRF/8XdSq+X5f1bKnRnolSlSYj6x8laGOpE2cQ1CPfVQIkxMD9r9ZZmER4VHvhsgXHmuvhnjGIp36u5aT7uBhdtPocyZsW56KhuwMLpuePmy7ykQr+PI11z4=
file_glob: true
file:
- $GH_APP-$OKARCH.deb
- $GH_APP-$OKARCH.rpm
skip_cleanup: true
on:
tags: true