Skip to content

Instantly share code, notes, and snippets.

@jk2K
Created September 7, 2016 02:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jk2K/8fc3352c08e8aa421ec577f04620375d to your computer and use it in GitHub Desktop.
Save jk2K/8fc3352c08e8aa421ec577f04620375d to your computer and use it in GitHub Desktop.
上传 APK 到 fir.im 上,Bash 脚本,无需依赖 Ruby
#!/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