There are, broadly speaking, three ways of answering the question “did I do the right thing?”
Deontology (oversimplified):
An action is right if it is accordance with certain moral duties or commands. Actions are good only insofar as they follow rules, and how we feel when we follow the rules, and the consequences of following the rules, are of a secondary concern. You have duties. Perform them. It is a rule-following ethic.
Consequentialism (oversimplified):
An action is right if it brings about good consequences and avoids bad consequences. How we feel when we maximize consequences may be important, because pleasure and pain are consequences of actions. Rules can be broken if they produce too much pain or harm. If you break a rule, that’s okay, as long as it’s done to bring about a good or better state of affairs. Every action is justified or criticized on whether or not it produces good consequences.
Virtue Ethics (oversimplified):
An action is right if it the person does it in the right way— if their feelings, intentions, and beliefs are all lined up so that they can perform the action in a certain way. Rules and consequences are important, but what is most important is that the person genuinely believes that what they’re doing is right, and is actually doing the right thing, and does not struggle to do so. There is a right belief, right feeling, and right intention, and actions are judged according to these requirements.