Publish to pages through branch

Is it possible to publish to GitLab pages through a branch?

I am doing my documentation on a branch separate from my master/main branch.

The link to my ci file is here:

But I am seeing the documentation last generated from the main branch on the pages website.

Is this ci file valid (it parses ok) and should it work or am I doing omething wrong?

I am using GitLab.com.