Start with archers in front, line formation with increased spacing, Infantry in a tight shield wall close behind.
When enemy get near, order infantry to advance just in front of the archers. They will be able to go through thanks to the wide spacing between the archers. This is also faster and more reliable than ordering the archers to move back (unless you order cease fire their will try to continue shooting).
Hold the shield wall for a few moments and then order the charge. Either order the archers to join the melee (cease fire, charge) or if the infantry are holding, leave them behind to shoot the runners in the back.
If I have cavalry, they will be put on hold to the back and to the side. They have 3 possible uses: 1) Against a larger archer force, order them manually to flank and release to charge only when close to the archers so they will not attempt to charge into the infantry formation. 2) Against reinforcement waves that arrive scattered, release the cavalry. They will get some kills and delay the enemy till you have your shield-wall/archers arranged again. Then call them back. 3) If all goes well and they are not needed, release them when the lines have been broken to hunt down the runners and end the scene quicker.