Last active
April 14, 2018 13:06
-
-
Save MegaBlackLabel/cd35dd2b2c0b211a6833be8212947216 to your computer and use it in GitHub Desktop.
Circle CIでビルド完了後にDropBoxにファイルをアップロードする。(🍏さんのシェルを改修)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ $# != 2 ] | |
then | |
echo 'Usage: upload_dropbox.sh <file> <token>' | |
exit 1 | |
fi | |
filename=XXXXX.pdf | |
echo "Delete $filename" | |
curl --fail -X POST https://api.dropboxapi.com/2/files/delete_v2 \ | |
--header "Authorization: Bearer $2" \ | |
--header "Content-Type: application/json" \ | |
--data "{\"path\": \"/$filename\"}" \ | |
|| exit 1 | |
echo "Upload $1 to $filename" | |
curl --fail -X POST https://content.dropboxapi.com/2/files/upload \ | |
--header "Authorization: Bearer $2" \ | |
--header "Dropbox-API-Arg: {\"path\": \"/$filename\",\"mode\": \"add\",\"autorename\": true,\"mute\": false}" \ | |
--header "Content-Type: application/octet-stream" \ | |
--data-binary @$1 \ | |
|| exit 1 | |
echo | |
echo "Success!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment