etcher/scripts/publish.sh
Juan Cruz Viotti d36509d995 Implement cross-platform build scripts (#395)
With the addition of native addons to Etcher, its no longer possible to
package the application for all operating system in a single host.

Given we need to build on Windows, we're creating cross-platform bash
and batch scripts and deprecating the original Makefile.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-10 16:07:18 -04:00

41 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
###
# Copyright 2016 Resin.io
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###
# See http://www.davidpashley.com/articles/writing-robust-shell-scripts/
set -u
set -e
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <file>" 1>&2
exit 1
fi
if ! command -v aws 1>/dev/null 2>/dev/null; then
echo "Dependency missing: aws cli" 1>&2
exit 1
fi
ETCHER_VERSION=`node -e "console.log(require('./package.json').version)"`
S3_BUCKET="resin-production-downloads"
aws s3api put-object \
--bucket $S3_BUCKET \
--acl public-read \
--key etcher/$ETCHER_VERSION/`basename $1` \
--body $1