Continuous integration Xcode Server after trigger $XCS_PRODUCT not set

Solutions Collect From Internet About “Continuous integration Xcode Server after trigger $XCS_PRODUCT not set”

I had the same problem and after discussion on Apple Developer Forums
I found out that there actually is .IPA file inside

/Library/Developer/XcodeServer/Integrations/Integration-INTEGRATION_ID/ExportedProduct/

directory and you can access it from After Trigger Script by using something like

originalBinaryName=$(basename "${XCS_ARCHIVE%.*}".ipa)
originalBinaryPath="${XCS_OUTPUT_DIR}/ExportedProduct/Apps/${originalBinaryName}"

I have also sent a bug report, because $XCS_PRODUCT should not be empty anyway, and it would be nice to have new environment variable for the complete path of .IPA file.