-
Notifications
You must be signed in to change notification settings - Fork 0
/
wercker.yml
92 lines (72 loc) · 2.26 KB
/
wercker.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
box: golang
launch-build:
steps:
- script:
name: Commit hash of change being built
code: git rev-parse HEAD
- script:
name: Commit detail
code: git show
development-build:
steps:
- wercker/setup-go-workspace:
package-dir: github.com/mevansam/cf-copy-plugin
- script:
name: Get govendor
code: |
go get -u github.com/kardianos/govendor
- script:
name: Synchronize vendored dependencies
code: |
govendor sync
- script:
name: Build
code: |
go build ./...
- script:
name: Run unit tests
code: |
govendor test -v +local
release-build:
steps:
- wercker/setup-go-workspace:
package-dir: github.com/mevansam/cf-copy-plugin
- wercker/add-to-known_hosts:
hostname: github.com
- script:
name: Install release tools
code: |
sudo apt-get update
sudo apt-get install -y zip bzip2
pushd /tmp
set -x
wget https://github.com/aktau/github-release/releases/download/v0.6.2/linux-amd64-github-release.tar.bz2 \
-O linux-amd64-github-release.tar.bz2
bunzip2 linux-amd64-github-release.tar.bz2
tar -xvf linux-amd64-github-release.tar
mv bin/linux/amd64/github-release /usr/local/bin/
set +x
popd
- add-ssh-key:
keyname: GIT_RELEASE_KEY
host: github.com
- script:
name: Build & publish release
code: |
git config --global user.email "$GIT_USER_EMAIL"
git config --global user.name "$GIT_USER_NAME"
git config --global push.default simple
set -x
TAG_AT_COMMIT=$(git show-ref --tags -d | grep $WERCKER_GIT_COMMIT | sed 's|.* refs/tags/\([0-9]*\.[0-9]*\.[0-9]*\).*|\1|')
if [[ -n $TAG_AT_COMMIT ]]; then
set +e
git tag -n1 -l $TAG_AT_COMMIT | grep "CF copy plugin release $TAG_AT_COMMIT" 2>&1 > /dev/null
if [[ $? -eq 0 ]]; then
set -e
./build-release.sh release
else
set -e
echo "No new tag for release build was detected."
fi
fi
set +x