Created
September 7, 2016 02:39
-
-
Save jk2K/8fc3352c08e8aa421ec577f04620375d to your computer and use it in GitHub Desktop.
上传 APK 到 fir.im 上,Bash 脚本,无需依赖 Ruby
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/bash | |
# Get API Token from http://fir.im/apps | |
API_TOKEN="your API token" | |
PACKAGE_PATH="demo-release.apk" | |
# ios or android | |
TYPE="android" | |
# App 的 bundleId | |
BUNDLE_ID="com.demo.app" | |
# Get upload_url | |
credential=$(curl -X "POST" "http://api.fir.im/apps" \ | |
-H "Content-Type: application/json" \ | |
-d "{\"type\":\"${TYPE}\", \"bundle_id\":\"${BUNDLE_ID}\", \"api_token\":\"${API_TOKEN}\"}" \ | |
2>/dev/null) | |
binary_response=$(echo ${credential} | grep -o "binary[^}]*") | |
KEY=$(echo ${binary_response} | awk -F '"' '{print $5}') | |
TOKEN=$(echo ${binary_response} | awk -F '"' '{print $9}') | |
UPLOAD_URL=$(echo ${binary_response} | awk -F '"' '{print $13}') | |
# Upload package | |
echo 'Uploading...' | |
echo '✈ -------------------------------------------- ✈' | |
response=$(curl -F "key=${KEY}" \ | |
-F "token=${TOKEN}" \ | |
-F "file=@${PACKAGE_PATH}" \ | |
-F "x:build=1" \ | |
${UPLOAD_URL} | |
) | |
echo $response; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment