Join stages of a build together for pipeline

I am trying to get my builds setup so its all under one pipeline. My work flow is like this: a branch is pushed up to gitlab and a staging site is made for testing. once it has been tested a merge request is made and the branch is merged to master. The issue i have is this is under 2 different pipe lines and im not sure how to combine them. This is what the two pipelines look like, how can I join them together?