How do environment variables work?

Let's supposed you have this Deployment Flow and you want a value in Dev1 to get replaced automatically when deploying to UAT and Production.
User-added image
The Custom Label value in Dev1. (This will work with any other component, it doesn't have to be a Custom Label)
User-added image
The Custom label value in UAT that you want to be replaced.
User-added image
The value in UAT should be replaced with: https://UATfakeurl.html

I set the environment variables like this:
User-added image
User-added image
Commit the Custom Label Account Summary in a user story.
The value: https://Dev1fakeurl.html in Dev1 gets replaced by the key: {!Environment.ACCOUNT_SUMMARY} in the feature branch.
User-added image

When promoting the user story the key: {!Environment.ACCOUNT_SUMMARY} in the feature branch is merged into the promotion branch and it will be replaced by the value in UAT: https://UATfakeurl.html when deploying.

This is the result after deploying:
User-added image
I can see in the deployment record that there was a replacement.
User-added image

How did we do?