Skip to content

Instantly share code, notes, and snippets.

@johnou
Created January 24, 2020 09:37
Show Gist options
  • Save johnou/d197707a85b89914f15e2ef76ab61cd9 to your computer and use it in GitHub Desktop.
Save johnou/d197707a85b89914f15e2ef76ab61cd9 to your computer and use it in GitHub Desktop.
Jenkins Facebook WebGL upload script
# Upload to Facebook
FACEBOOK_CLIENT_ID=xxxx
FACEBOOK_CLIENT_SECRET=xxxx
FACEBOOK_APP_ID=1234
cd $WORKSPACE/build
zip -r MyGame_WebGL.zip MyGame_WebGL
BUILD_DATE=$(date '+%Y-%m-%d %H:%M:%S')
set +x
FB_UPLOAD_TOKEN=$(curl -s -X GET "https://graph.facebook.com/oauth/access_token?client_id=$FACEBOOK_CLIENT_ID&client_secret=$FACEBOOK_CLIENT_SECRET&grant_type=client_credentials" | python -c "import json,sys;obj=json.load(sys.stdin);print obj['access_token'];")
curl -F "asset=@./MyGame_WebGL.zip" -F "comment=Revision $GIT_COMMIT built on $BUILD_DATE" -F "access_token=$FB_UPLOAD_TOKEN" -F "type=UNITY_WEBGL" "https://graph.facebook.com/$FACEBOOK_APP_ID/assets"
set -x
rm -f MyGame_WebGL.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment