简体   繁体   中英

GIT Workflow - with dev and staging environments

I'm a newbie to git and have been looking and some workflows. I found this and really like it but I do have some questions.

I've set up a post receive hook on the master that updates a production server with all of the latest changes, however, I'm wondering how to handle dev and/or staging environments.

Is there a way to update subdomains on the server (ie: dev.mydomain.com, staging.mydomain.com) based on branch changes without having to maintain multiple repos for one project? If I push and only the develop branch changed, it would be great to update dev.mydomain.com. If I'm pushing changes to release branches, staging.mydomain.com would ideally update.

Also - I'm not using github. We have this setup on our own CentOS server with WHM/CPanel if any of that matters.

I don't see why you cannot do this. You should be able to grab the name of the branch that was just pushed ( Writing a git post-receive hook to deal with a specific branch ) and then deploy from the shell script.

一种明智的方法是将存储库克隆到每个子域的webdir,在其中检出相应的分支,并配置git钩子,以便在有任何推送时更新这些存储库。

Git itself only provides the Repository structure and how Developers work together. For different Stages you should add cloned Projects, because they are supposed to diverge. Maintaining them is an important task, you can simply do this by hand or Write some Bash scripts, or even some CLI Programms for that. Maybe the Panel you are using, does provide some API calls. GitLab for Example has an API to automaticly do this kind of Stuff.

After that, all that matters is Timing it with an Cron Job or an Interface. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM