简体   繁体   中英

Deploy changed files, using git, to staging and live server

So I'm using git (BitBucket) in my workflow and I wan't to ditch classic FTP upload and use some kind of "git powered" deployment executed via the terminal.

So this is the setup I would prefer:

  • A config file at the root of the project folder with FTP details for a staging server and a live server (2 different servers/locations).
  • When I execute a command like "deploy staging" all files that has been changed, according to git, will be uploaded to the staging server.
  • When I execute a command like "deploy live" all files that has been changed, according to git, will be uploaded to the live server.
  • When a another developer from my team pulls a project, he can execute the above commands just like he would be able to install the required gulp-modules and start Gulp.

How can I achieve this?

In order to pull this off you will need to incorporate some sort of CICD(Continuous Integration/Continuous Deployment) pipeline. There are many different flavors of this, but since you are using Bitbucket you may want to look into Atlassian's Bamboo .

Once you integrate that into your pipeline, you would need to have the tool poll for changes in your git repository. Once it sees those changes, it can automatically run any tests that you have and once they pass it can do a gulp deploy staging or gulp deploy live .

Atlassian have a pretty decent amount of resources on this using their set of tools here as well.

Sounds like you want to give DeployHQ a try.

  • Add one or many environments/servers like staging and production.
  • Lets you define individual config files for each server.
  • You can trigger deployments automatically (whenever you push) or submitting a simple POST request to a special URL.

There are a lot more features too!

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