11#! /bin/bash
22#
3- # Dependencies:
4- #
5- # jsontool: `npm install -g jsontool`
6- # s3cmd: `brew install s3cmd && s3cmd --configure`
7- #
83
94set -e
105
@@ -41,37 +36,6 @@ json_key () {
4136 echo " ${response} " | json " ${key} " | tr -d ' \n'
4237}
4338
44- upload_zip () {
45- local uname=" ${1} "
46- local passw=" ${2} "
47- local fname=" ${3} "
48- local descr=" ${4} "
49-
50- local response=$( curl -s -u " ${uname} :${passw} " \
51- -X POST \
52- -H " Accept: application/vnd.github.beta+json" \
53- -H " Content-Type: application/json" \
54- -d ' {
55- "name": "' " ${fname} " ' ",
56- "size": ' " $( stat -f " %z" " ${fname} " | tr -d ' \n' ) " ' ,
57- "description": "' " ${descr} " ' ",
58- "content_type": "application/zip"
59- }' \
60- https://api.github.com/repos/okfn/annotator/downloads)
61-
62- curl \
63- -F " key=$( json_key " ${response} " path) " \
64- -F " acl=$( json_key " ${response} " acl) " \
65- -F " success_action_status=201" \
66- -F " Filename=$( json_key " ${response} " name) " \
67- -F " AWSAccessKeyId=$( json_key " ${response} " accesskeyid) " \
68- -F " Policy=$( json_key " ${response} " policy) " \
69- -F " Signature=$( json_key " ${response} " signature) " \
70- -F " Content-Type=$( json_key " ${response} " mime_type) " \
71- -F " file=@${fname} " \
72- https://github.s3.amazonaws.com/
73- }
74-
7539maybe () {
7640 if [ -n " $DRY_RUN " ]; then
7741 echo " $@ "
@@ -150,7 +114,7 @@ echo "Uploading release to S3"
150114[ -n " $S3CFG " ] && S3ARGS=" -c $S3CFG "
151115maybe s3cmd $S3ARGS --acl-public sync pkg/* .{js,css} " s3://assets.annotateit.org/annotator/v${VERSION} /"
152116
153- # Make zips and upload to GitHub
117+ # Make zips
154118
155119echo " Making zips for GitHub"
156120pushd pkg/
@@ -162,19 +126,3 @@ zip -r9 "annotator.${VERSION}.zip" "annotator.${VERSION}"
162126mkdir " annotator-full.${VERSION} "
163127ln annotator-full.min.js annotator.min.css " annotator-full.${VERSION} "
164128zip -r9 " annotator-full.${VERSION} .zip" " annotator-full.${VERSION} "
165-
166- echo " Uploading zips to GitHub. Please enter your credentials..."
167- read -p " GitHub username: " uname
168- stty -echo
169- read -p " GitHub password: " passw; echo
170- stty echo
171-
172- echo " Uploading zips to GitHub"
173- maybe upload_zip " ${uname} " " ${passw} " " annotator.${VERSION} .zip" " Annotator ${VERSION} with plugins in individual minified files"
174- maybe upload_zip " ${uname} " " ${passw} " " annotator-full.${VERSION} .zip" " Annotator ${VERSION} with plugins all in one minified file"
175-
176- popd
177-
178- # Clean up
179- echo " Cleaning up"
180- (cd pkg && make clean)
0 commit comments