Best way to deploy to different enviroments?


#1

Hi all,

I was wondering how to deploy to different environments in the best way to do it and how to set, for example, if I want just to deploy my staging (but not my production), how to set up/works this? Or perhaps, If I want to commit it, but I don’t want to place it on my staging or prod environment.

Right now, I just know the way to deploy always in the same place and everytime I do a commit (I’m completely new on this…), and I run a bash script in one of my steps of a simple job.

For another hand, makeing some research, I also seeing this about deployment syntax.

deployment:
  production:
    branch: production
    commands:
      - bash ./deploy_prod.sh
  staging:
    branch: master
    commands:
      - bash ./deploy_staging.sh

This code below, is meaning that every time the push is did from the production branch, it will be autodetected that is from there, and make just the commands of ‘production’?

Thanks in advance, happy saturday.


#2