forked from tryanzu/anzu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSupfile
More file actions
56 lines (56 loc) · 2.06 KB
/
Copy pathSupfile
File metadata and controls
56 lines (56 loc) · 2.06 KB
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
# Supfile
---
version: 0.1
env:
BUILD_PATH: /opt/gopath/src/github.com/fernandez14/spartangeek-blacker
REL_PATH: /home/spartan/dist/blacker
SENTRY_URL: https://sentry.io/api/hooks/release/builtin/111765/1502a0900a9490684776a3f8b2a298c6cabd6fb20d547df97c0f4b81a116baf4/
SLACK_WEEKHOOK: https://hooks.slack.com/services/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
networks:
production:
hosts:
commands:
pull:
desc: Pull latest repository updates
run: cd $BUILD_PATH && git pull
build:
desc: Build latest repository updates
run: source /etc/profile && cd $BUILD_PATH && glide install && go build -o blacker
release-build:
desc: Create new relase using latest build
run: cd $REL_PATH/releases && mkdir $SUP_TIME && cd ./$SUP_TIME && cp $BUILD_PATH/blacker ./blacker && rm $REL_PATH/current; ln -s $REL_PATH/releases/$SUP_TIME $REL_PATH/current
cleanup-releases:
desc: Cleanup old releases
run: ls -1d $REL_PATH/releases/* | \sort -rg | \tail -n +4 | \xargs /bin/rm -rf
restart:
desc: Restart all pm2 processes
run: pm2 restart blacker-api && pm2 restart blacker-dev
logs:
desc: Watch pm2 logs
run: pm2 logs
notify-sentry:
desc: Notify sentry about new version deployed
run: >
cd $BUILD_PATH && VERSION=$(git rev-list --count HEAD);
curl $SENTRY_URL \
-X POST \
-H 'Content-Type: application/json' \
-d '{"version": "'$VERSION'"}'
notify-slack:
desc: Notify slack about new version deployed
run: >
cd $BUILD_PATH && VERSION=$(git rev-list --count HEAD);
curl -X POST --data-urlencode 'payload={"text": "Version '$VERSION' was deployed successfully."}' $SLACK_WEEKHOOK
bash:
desc: Interactive Bash on all hosts
stdin: true
run: bash
targets:
deploy:
- pull
- build
- release-build
- restart
- cleanup-releases
- notify-sentry