In general, you always follow the steps in the Quick Reference Handbook (QRH) after any failure or other problem. An engine fire is serious enough that it requires Memory Items, which are performed immediately before getting the QRH. In this case, the memory items are the first 5 steps of the QRH checklist:
ENGINE FIRE or Engine Severe Damage or Separation
- Autothrottle (if engaged) . . . . . . . . . . .Disengage
- Thrust lever (affected engine) . . . . . . . . Confirm . . . . . Close
- Engine start lever (affected engine) . . . . . . . . Confirm . . . CUTOFF
- Engine fire switch (affected engine) . . . . . . . . Confirm . . . . . . Pull
To manually unlock the engine fire switch, press
the override and pull.
- If the engine fire switch or ENG OVERHEAT light
stays illuminated:
Engine fire switch . . . . . Rotate to the stop and
hold for 1 second
If after 30 seconds the engine fire switch or ENG
OVERHEAT light stays illuminated:
Engine fire switch. . . . . . . .Rotate to the
other stop and
hold for 1 second
- If high airframe vibration occurs and continues
after the engine is shut down:
Without delay, reduce airspeed and descend to
a safe altitude which results in an acceptable
vibration level.
If high vibration returns and further airspeed
reduction and descent are not practicable,
increasing airspeed may reduce vibration.
- ISOLATION VALVE switch . . . . . . . . . . . . CLOSE
- PACK switch (affected side) . . . . . . . . . . . . . OFF
This causes the operating pack to regulate to
high flow in flight with the flaps up.
- APU BLEED air switch . . . . . . . . . . . . . . . . . OFF
- Choose one:
- APU is available for start:
APU . . . . . . . . . . . . . . . . . . . . . . START
When APU is running:
APU GEN switch (affected side) . . . . . . . . . . . . . ON
- APU is not available:
Go to step 11
- Balance fuel as needed.
- Transponder mode selector . . . . . . . . . . TA ONLY
This prevents climb commands which can
exceed single engine performance capability.
- If wing anti–ice is needed:
ISOLATION VALVE switch (after fire has been extinguished). . . . . . AUTO
- Plan to land at the nearest suitable airport.
(Boeing 737NG QRH 8.2)
You can see that the items 2 to 4 have a Confirm written before the actual action. This means that the Pilot Flying (PF) will put their hand on the respective lever, then the Pilot Monitoring (PM) confirms that this is indeed the correct one for the engine that has a fire and says "Confirm" and only then the PF will actually perform the action. This is to make sure that you don't accidentally shut down the operating engine. After step 5, the engine with the fire indication is shut off and the fire should be extinguished.
After performing the memory items, the PM would get the QRH out and the pilots will work through the checklist (including verifying that steps 1-5 have been performed correctly).
The steps do not depend on the situation (climb, cruise or approach). You always follow the above procedure. The general order of importance is Aviate, Navigate, Communicate: first you keep the aircraft flying, then you figure out where you are going and where you want to go, then you communicate with ATC.
What should the pilot do in the cabin in these three situations?
I'm not sure what you mean by this. The pilots are in the cockpit and after figuring out what to do next, they will communicate with the cabin crew and the captain will probably make a PA to the passengers.
If you refer to pilots flying as passengers in the cabin: They would probably do nothing. A single engine fire is trained regularly by the flight crew and the two pilots in the cockpit should have no trouble handling the situation without help of a third pilot.
And at the climb stage, should the plane return to the airport of origin or continue the flight?
You can see in the checklist that step 14 says: "land at the nearest suitable airport". This is not as strict as "land as soon as possible", where you should get the aircraft on the ground without any delay (smaller airport, military airport, whatever). The nearest suitable airport should be a civilian airport within normal descent range where a landing can be performed without further risk. In the initial climb stage, this would typically be the departure airport.
Continuing the flight to the destination should only be done when the aircraft is already close to the destination anyway (e.g. during descent). An engine fire during cruise may require diverting to a different suitable airport.