Steps:
TARGET DECK: DevOps/gitlab-ci
basic gitlab-ci template #flashcard
.deploy_template:
stage: deploy
script:
- # something...
deploy_prod:
extends: .deploy_template
An example to deploy in different environments:
###########
# template
###########
.deploy_template
stage: deploy
script:
- # commands
- deploy $TARGET_SERVER
variables:
TARGET_SERVER: ''
###########
# prod
###########
deploy_prod:
extends: .deploy_template
variables:
TARGET_SERVER: example.com
rules:
- if: $CI_COMMIT_BRANCH == "master"
###########
# release
###########
deploy_release:
extends: .deploy_template
variables:
TARGET_SERVER: release.example.com
rules:
- if: $CI_COMMIT_BRANCH =~ /^release.*/
###########
# dev
###########
deploy_release:
extends: .deploy_template
variables:
TARGET_SERVER: dev.example.com
rules:
- if: $CI_COMMIT_BRANCH == "develop"