Summary
In case it can help someone, here my solution.
Our team uses a "self-hosted" Sentry instance, so I had to provide the URL to sentry-cli.
Instead of passing the parameters directly as arguments to the binary, I used the Environment Variable panel in XCode Cloud.
SENTRY_URL, SENTRY_ORG, SENTRY_PROJECT, SENTRY_AUTH_TOKEN.
The advantage is that your variables do not appear in the script, and also you can set the SENTRY_AUTH_TOKEN as secret.
Another advantage of XCode Cloud is that you can use Homebrew to install dependencies. See documentation.
Scripts
ci_scripts/ci_post_clone.sh
#!/bin/sh
brew install getsentry/tools/sentry-cli
ci_scripts/ci_post_xcodebuild.sh
#!/bin/sh
if which sentry-cli >/dev/null; then
ERROR=$(sentry-cli upload-dif --include-sources "$CI_ARCHIVE_PATH/dSYMs" 2>&1 >/dev/null)
if [ ! $? -eq 0 ]; then
echo "warning: sentry-cli - $ERROR"
fi
else
echo "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"
fi