why go through such a hassle when you can have a cvt moped engine gearbox combo because to accomplish what you want, you need something to rotate the shift drum (easy) and something to disengage the engine from the transmission while shifting (hard)
the very early Honda CB750 had an automatic gearbox that used a torque convertor like a car's automatic and shifted gears. It was very fiddly to repair.