Reputation: 3184
I have a simple example, but I can't find any solution for this. Imagine we have simple server with Apache2, MySQL, and PHP running services. Also we have installed GitLab.
We have a project with two working directories/repos: Master -> (folder "Production" in var/www/production
) and the development branch development -> (folder in var/www/development
).
When a user commits and pushes code from local git to the development branch, GitLab should do a pull request in the development folder on the server. The same situation should happen with the production folder (master branch).
How we should configure our .gitlab-ci.yml
file for this?
Upvotes: 1
Views: 2863
Reputation: 3092
You can configure gitlab ci to run the development job when a commit is pushed in the development branch and to run the production job when a commit is pushed in the master branch
deploy-dev:
stage: deploy
script:
- do-something # Deploy to dev
only:
- development
and for the production
deploy-prod:
stage: deploy
script:
- do-something # Deploy to prod
only:
- master
You still need to edit the script to deploy the files onto your server, probably using SSH.
Upvotes: 1