Invisibility does not end because you take an attack action, it ends if you attack. Since 5E is written in naturalistic language it can't be parsed like a technical document which is different than some previous versions.
I rule that any action that intentionally harms or interferes with another creature is an attack. Distracting someone is interfering with another creature and therefore falls under the umbrella of "attacking". In this case, the invisible creature has to somehow physically interact with the target - otherwise how else are you distracting them? There are a lot of things an invisible person can do that I would consider an attack that are not enumerated under the attack action.
As far as the opportunity attack, you don't get an opportunity attack against a creature you can't see.
I rule that any action that intentionally harms or interferes with another creature is an attack. Distracting someone is interfering with another creature and therefore falls under the umbrella of "attacking". In this case, the invisible creature has to somehow physically interact with the target - otherwise how else are you distracting them? There are a lot of things an invisible person can do that I would consider an attack that are not enumerated under the attack action.
As far as the opportunity attack, you don't get an opportunity attack against a creature you can't see.