My problem had a similar but different cause to the one described in @JasonGenX's post.
My app had some files that got modified when I ran it, and that caused the app's signature to fail verification.
To fix it, I removed those files and prevented them from ever being created or modified, so that the .app bundle should never change on its own.
Specifically, I had Python code in my app bundle. When the app ran Python, it compiled imports to .pyc files. These got signed along with the rest of the app bundle.
When I ran the .app before creating the DMG, Python updated & modified these .pyc files, so they no longer passed signature verification. I verified this using:
$ codesign --verify --verbose=4 my.app
[...]
my.app: a sealed resource is missing or invalid
file modified: /private/tmp/my.app/Contents/Resources/python-dist/chardet/codingstatemachine.pyc
file modified: /private/tmp/my.app/Contents/Resources/python-dist/chardet/euckrprober.pyc
[...etc...]
The .app still ran on my own computer because I had built it myself, so it was trusted. But when I uploaded & downloaded the DMG, it got tagged to indicate it had come from an untrusted source and required signature verification.
Since the signature verification failed, MacOS reported that the app bundle was damaged.
The fix was to delete the .pyc files from my bundled Python resources, and run Python as python -B, which instructs it not to create .pyc files.
I rebuilt my .app bundle without the .pyc files, and Python no longer creates them, so the .app bundle remains unmodified.