Last active
April 15, 2024 12:21
-
-
Save Novack/2f93edb5636efcb535085ad19df69511 to your computer and use it in GitHub Desktop.
PowerShell script for updating and deploying the Playfab cloudscript from command line.
This file contains 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
# Project and Dev Info. Fill it! | |
$devPlayfabId = "" | |
$titleId = "" | |
$secretKey = "" | |
# Concats all .js files on directory. This script is expected to be placed on the directory containing the javascript files. Otherwise, add the path(s). | |
$scriptContent = Get-Content *.js | out-string | |
# Script content as Playfab expects it. | |
$file = @{ | |
Filename = "revision.js" | |
FileContents = $scriptContent | |
} | |
# Request Data | |
$url = "https://" + $titleId + ".playfabapi.com/Admin/UpdateCloudScript" | |
$headers = @{ "X-SecretKey" = $secretKey;} | |
$body = @{ | |
DeveloperPlayFabId = $devPlayfabId | |
Publish = "true" | |
Files = @( $file ) | |
} | ConvertTo-Json | |
# Execute Rquest. | |
$R = Invoke-WebRequest -URI $url -Method "Post" -ContentType "application/json" -Headers $headers -Body $body | |
"Response Status: " + $R.StatusCode + " - " + $R.StatusDescription + "\n" + $R.Content | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment