For personal simplicity I would git clone https://github.com/duxingkei33/orangepi_PC_gpio_pyH3
Setup whatever pin you're connecting the switch to using the PYA20 library's (above) example code as seen here: https://pypi.python.org/pypi/pyA20
Use that library read the switch. For example: If pin high/low or on/off, use python subprocess or os.system functions to run linux shutdown, reboot command.
I might be able to give you a sample script or more concise instructions but don't hold your breath. For now I'll give you this, which is a pretty damn good start for having not really started
This is a script I was using on a NanoPiNeoAir using a reed (magnetic) switch attached to a door but could be easily changed to suit your needs. I've commented out the stuff that you won't need but much of the variable names are the same soo.... pretend the door is your switch! Or you can change the prompts/names yourself.
P.s. You'll need to specify the pin you're using for your button but if you use my script in tandem with the tutorial you link to (replace LED with switch) it should 'technically' work. Hack away at it, see what you can come up with and report back. Also..... you have heatsinks on your RAM dies but not your CPU? Sup with that?
Don't try to enable internal GPIO pullups, it is waste of time since internal ones are too weak for I2C, which need something like 3K while internals are usually around 30K.
Simply add some external ones on one of your peripherals ...