forked from semaphoreui/semaphore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.sh
executable file
·90 lines (71 loc) · 2.11 KB
/
make.sh
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
#!/bin/bash
set -e
if [ "$1" == "ci_test" ]; then
echo "Creating CI Test config.json"
cat > config.json <<EOF
{
"mysql": {
"host": "127.0.0.1:3306",
"user": "ubuntu",
"pass": "",
"name": "circle_test"
},
"session_db": "127.0.0.1:6379",
"port": ":8010",
"email_alert": false
}
EOF
cd public
lessc css/semaphore.less > css/semaphore.css
pug $(find ./html/ -name "*.pug")
cd -
fi
cd public
node ./bundler.js
cd -
echo "Adding bindata"
if [ "$1" == "release" ]; then
VERSION=$2
cat <<HEREDOC > util/version.go
package util
var Version string = "$VERSION"
HEREDOC
echo "Updating changelog:"
set +e
git changelog -t "v$VERSION"
set -e
echo "\nCommitting version.go and changelog update"
git add util/version.go CHANGELOG.md && git commit -m "update changelog, bump version to $VERSION"
echo "\nTagging release"
git tag -m "v$VERSION release" "v$VERSION"
echo "\nPushing to repository"
git push origin develop "v$VERSION"
echo "\nCreating draft release v$VERSION"
github-release release --draft -u ansible-semaphore -r semaphore -t "v$VERSION" -d "## Special thanks to\n\n## Installation\n\nFollow [wiki/Installation](https://github.com/ansible-semaphore/semaphore/wiki/Installation)\n\n## Changelog"
fi
packr
if [ "$1" == "ci_test" ]; then
exit 0
fi
if [ "$1" == "watch" ]; then
cd public
nodemon -w js -i bundle.js -e js bundler.js &
nodemon -w css -e less --exec "lessc css/semaphore.less > css/semaphore.css" &
pug -w -P --doctype html $(find ./html/ -name "*.pug") &
cd -
reflex -r '\.go$' -R '^public/vendor/' -R '^node_modules/' -s -d none -- sh -c 'go build -i -o /tmp/semaphore_bin cli/main.go && /tmp/semaphore_bin'
exit 0
fi
cd cli
gox -output="semaphore_{{.OS}}_{{.Arch}}" ./...
if [ "$CIRCLE_ARTIFACTS" != "" ]; then
rsync -a semaphore_* $CIRCLE_ARTIFACTS/
exit 0
fi
if [ "$1" == "release" ]; then
echo "Uploading files.."
find . -name "semaphore_*" -exec sh -c 'gpg --armor --detach-sig "$1"' _ {} \;
VERSION=$2 find . -name "semaphore_*" -exec sh -c 'github-release upload -u ansible-semaphore -r semaphore -t "v$VERSION" -n "${1/.\/}" -f "$1"' _ {} \;
echo "Done"
rm -f semaphore_*
fi