mycroft-precise/publish.sh

40 lines
877 B
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"
cfg_file="~/.s3cfg.mycroft-artifact-writer"
[ -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 01:03:12 +00:00
# Usage: show_version stable|unstable
find_version() {
[ "$1" = "stable" ] && $(git describe --abbrev=0) || date +%s
}
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 "$@"
version="$(find_version)"
arch="$(find_arch)"
sudo pip3 install pyinstaller
pyinstaller -y precise.stream.spec
2017-11-03 23:22:38 +00:00
2017-11-08 01:03:12 +00:00
upload_file dist/precise-stream bootstrap.mycroft.ai/artifacts/static/release/$arch/$version/
2017-11-03 23:22:38 +00:00