God knows what you did.
When sanctuary was originally published, it was available only to Clerics and Paladins. This gives some insight into the original intent for the spell's function. The question here is something like "Can I claim that it wasn't me, but it was the dynamite, that hurt those creatures?" And in the context of a caster deriving their power in some way from a higher power, as clerics and paladins do, you definitely cannot make that claim.
It seems clear enough that the last phrase, "or deals damage to another creature, this spell ends" is supposed to be the "junk-drawer" stipulation - it catches all the other junk that should end the spell that isn't technically a spell or an attack.
There is room for the DM to rule otherwise, but it seems pretty obvious that the "I didn't hurt those creatures, it was the bomb (that I threw with the intent to kill those creatures)" loop hole is not how the spell is supposed to work.
Now, the spell sanctuary is available to the more recently published Artificer and the Genie Warlock, so I need to explain my argument a little bit more. There is no deity controlling the function or establishing the rules of an artificer's spells, so that is not the argument I am making for the artificer or genie-lock. Rather, I am saying "the spell originally functioned this way, for this reason, and did so for many years until the release of the artificer, which tells the intent for the spell's function. We then apply this intent for the spell's function to the newer use cases". But, it is because of the artificer and genie warlock having the spell that I say “there is room for the DM to rule otherwise”.