Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ApprenticeGC/94f71bbdb9a2f3a465d7f331e0741847 to your computer and use it in GitHub Desktop.
Save ApprenticeGC/94f71bbdb9a2f3a465d7f331e0741847 to your computer and use it in GitHub Desktop.
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