Create two different steps one with
Only: master, only: test
deploy_master:
script:
- <script to deploy to master server>
only:
- master
deploy_test:
script:
- <script to deploy to test server>
only:
- test
And make changes accordingly to the script to deploy to a different server.