So what's the new ruling on timing? I don't follow twitter.
Clarification about bonus actions: if a feature says you can do X as a bonus action if you do Y, you must do Y before you can do X. For Shield Master, that means the bonus action must come after the Attack action. You decide when it happens afterward that turn.
https://twitter.com/JeremyECrawford/status/994993596989300736
FYI, you have to complete the Attack action before you can use the Shield Master bonus action. You can't use it between attacks.