mycroft-precise/publish.sh

48 lines
1.1 KiB
Bash
Raw Normal View History

2017-11-03 23:22:38 +00:00
#!/usr/bin/env bash
2017-11-08 01:03:12 +00:00
# Usage: upload_file FILE REMOTE_PATH
upload_file() {
file="$1"
remote_url="s3://$2"
2017-11-08 01:26:20 +00:00
eval cfg_file="~/.s3cfg.mycroft-artifact-writer"
2017-11-08 01:03:12 +00:00
[ -f "$cfg_file" ] && s3cmd put $1 $remote_url --acl-public -c ~/.s3cfg.mycroft-artifact-writer || echo "Could not find $cfg_file. Skipping upload."
}
2017-11-03 23:22:38 +00:00
2017-11-08 19:41:08 +00:00
# Usage: find_type stable|unstable
find_type() {
[ "$1" = "stable" ] && echo "release" || echo "daily"
}
# Usage: find_version stable|unstable
2017-11-08 01:03:12 +00:00
find_version() {
2017-11-08 19:41:08 +00:00
[ "$1" = "stable" ] && git describe --abbrev=0 || date +%s
2017-11-08 01:03:12 +00:00
}
2017-11-03 23:22:38 +00:00
2017-11-08 01:03:12 +00:00
find_arch() {
python3 -c 'import platform; print(platform.machine())'
}
2017-11-03 23:22:38 +00:00
2017-11-08 01:03:12 +00:00
# Usage: check_args "$@"
check_args() {
if [ $# != 1 ]; then
echo "Usage: $1 stable|unstable"
exit 1
fi
}
set -e
2017-11-03 23:22:38 +00:00
2017-11-08 01:03:12 +00:00
check_args "$@"
2017-11-08 19:41:08 +00:00
type="$(find_type $@)"
version="$(find_version $@)"
2017-11-08 01:03:12 +00:00
arch="$(find_arch)"
sudo pip3 install pyinstaller
pyinstaller -y precise.stream.spec
2017-11-03 23:22:38 +00:00
2017-11-08 02:45:48 +00:00
echo $version > latest
2017-11-08 19:41:08 +00:00
upload_file dist/precise-stream bootstrap.mycroft.ai/artifacts/static/$type/$arch/$version/
upload_file latest bootstrap.mycroft.ai/artifacts/static/$type/$arch/
2017-11-03 23:22:38 +00:00