Last active
August 1, 2021 09:52
-
-
Save ApprenticeGC/94f71bbdb9a2f3a465d7f331e0741847 to your computer and use it in GitHub Desktop.
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
| export CATALOG_URL=$(curl -s \ | |
| --header "authorization: Basic $CCD_AUTH_KEY" \ | |
| --header "content-type: application/json" \ | |
| --request GET \ | |
| --url "https://content-api.cloud.unity3d.com/api/v1/buckets/${CCD_BUCKET_ID}/entries/" | \ | |
| jq -r '[[.[] | select(.path | contains(".json"))] | sort_by(.last_modified) | reverse[]] | .[0] | .content_link') | |
| EXCLUDED_CONFIG_CONTENT=$(echo ${UNITY_REMOTE_CONFIG_CONTENT} | \ | |
| jq \ | |
| --arg catalogUrl "$CATALOG_URL" \ | |
| --arg findingKey "catalogUrl_$PROJECT_NAME" \ | |
| 'del(.value[] | select(.key | contains($findingKey)))') \ | |
| MODIFIED_CONTENT=$(echo ${UNITY_REMOTE_CONFIG_CONTENT} | \ | |
| jq \ | |
| --arg catalogUrl "$CATALOG_URL" \ | |
| --arg findingKey "catalogUrl_$PROJECT_NAME" \ | |
| '.value[] | select(.key | contains($findingKey)) | .value = $catalogUrl') \ | |
| && echo ${EXCLUDED_CONFIG_CONTENT} | \ | |
| jq \ | |
| --arg modifiedContent "$MODIFIED_CONTENT" \ | |
| '.value += [$modifiedContent | fromjson]' > payload.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment