Semaphore/make.sh

96 lines
2.3 KiB
Bash
Raw Normal View History

2016-01-05 00:32:53 +01:00
#!/bin/bash
2016-01-06 12:38:01 +01:00
set -e
2016-03-18 23:03:28 +01:00
2016-01-05 00:32:53 +01:00
BINDATA_ARGS="-o util/bindata.go -pkg util"
2016-03-18 23:03:28 +01:00
if [ "$1" == "watch" ]; then
2016-01-05 00:32:53 +01:00
BINDATA_ARGS="-debug ${BINDATA_ARGS}"
echo "Creating util/bindata.go with file proxy"
else
echo "Creating util/bindata.go"
fi
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
2016-01-05 00:32:53 +01:00
}
EOF
2016-05-24 00:59:45 +02:00
cd public
lessc css/semaphore.less > css/semaphore.css
2017-02-22 12:52:50 +01:00
pug html/*.pug html/*/*.pug html/*/*/*.pug
2016-05-24 00:59:45 +02:00
cd -
2016-01-05 00:32:53 +01:00
fi
2016-03-18 23:03:28 +01:00
cd public
node ./bundler.js
cd -
2016-01-06 12:20:07 +01:00
echo "Adding bindata"
if [ "$1" == "release" ]; then
VERSION=$2
cat <<HEREDOC > util/version.go
package util
var Version string = "$VERSION"
HEREDOC
echo "Updating changelog:"
git changelog -t "v$VERSION"
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 master "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
go-bindata $BINDATA_ARGS config.json db/migrations/ $(find public/* -type d -print)
2016-01-05 00:32:53 +01:00
2016-05-21 01:47:09 +02:00
if [ "$1" == "ci_test" ]; then
exit 0
fi
2016-03-18 23:03:28 +01:00
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 html/*.pug html/*/*.pug html/*/*/*.pug &
2016-04-30 09:52:33 +02:00
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'
2016-04-30 09:52:33 +02:00
exit 0
2016-03-18 23:03:28 +01:00
fi
2016-05-24 11:55:48 +02:00
cd cli
2016-12-21 10:36:54 +01:00
gox -output="semaphore_{{.OS}}_{{.Arch}}" ./...
2016-05-23 22:08:28 +02:00
if [ "$CIRCLE_ARTIFACTS" != "" ]; then
rsync -a semaphore_* $CIRCLE_ARTIFACTS/
exit 0
2016-06-02 20:26:51 +02:00
fi
if [ "$1" == "release" ]; then
echo "Uploading files.."
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