Check the hardware specifications for UE4. You can find them here:
Minimum: A mac that supports macOS 10.14 Mojave. So that would be a Mac mini late 2012 or later.
This would also be able to run the latest MacOS Catalina. This is important so you can use the latest version of XCode.
Such a machine is not recommended to work efficiently, but if your game is mostly done on another machine, this would be enough to compile, sign and upload to App Store Connect.