How to deploy onto a remote server?

Hi All,

I have defined a CI/CD pipeline (with 3 stages: build, test and deploy) for my project. I am locally running a Git-lab Runner and IIS server is also hosted on my local machine.

The “deploy” stage looks as follows:

stage: deploy
    script:
        - echo "Deployintg Projects WF.Engine.RestApi and WF.Manager.RestApi to WDEC015488 server... "
        - Publish_WDEC015488.cmd
    tags:
        - default
    environment:
        name: WDEC015488
    only:
        - master
    #except:
        #- master
     #   - branches
    dependencies:
        - Test
       

The Publish script (attached) contains basic console commands.
The important one is the following:

dotnet publish WF.Engine.RestApi/WF.Engine.RestApi.csproj -c release -o %DIST_PATH_WFE%

where DIST_PATH_WFE=“C:\Office_Documents\GBox\New_Solution\IIS\WF.Engine.RestApi”

Everything works fine when it comes to locally publishing the binaries onto my local machine.

My question is how can I publish the binaries through my local runner onto the “remote” windows server where the staging IIS is running?

One solution I tried is to configure a separate Git-lab Runner onto the remote windows server. It works, but it is not very elegant (2 runners competing on the same set of jobs (deploy) makes things confusing). I want to control the deployment from a single runner onto different machines. For example, by defining a separate set of deploy jobs/stages for each environment with its specific set of configurations in the same .yml file.