First demonstration of early warning gravitational-wave alerts