Use an N channel MOSFET to separate the 5v devices from the 12v devices. Tie the gate and source to the 5v bus, and the drain to the 12v bus. Then a pullup resistor on both sides.
When a 5v device drives high, Vgs = 0, and the pullup pulls the 12v device all the way to 12v. When a 5v device drives low, the MOSFET turns on, and pulls the 12v bus to ground.
When a 12v device drives high, nothing happens. The MOSFET is off, and the 5v pullup keeps the 5v side high. When a 12v device drives to ground, the internal source,drain diode of the MOSFET becomes forward biased, and the 5v side gets pulled down to ground.
This is a simple bidirectional bus translator you'll find in all the literature. Just do a google search on MOSFET bidirectional level shifter. It's an easy solution for just a few cents.