The current network connection determines the public IP address. Every device on a network has the same public, outward-facing IP address. As a result, when you join a new WiFi network, your public IP address changes.