Skip to content

Instantly share code, notes, and snippets.

@dungdm93
Last active August 20, 2021 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dungdm93/65c4802c9c9897c582f510aa419db650 to your computer and use it in GitHub Desktop.
Save dungdm93/65c4802c9c9897c582f510aa419db650 to your computer and use it in GitHub Desktop.
GitLab-CI: Deploy Scripts
deploy:paas-gae:
stage: deploy
image: google/cloud-sdk
before_script:
- echo "${GCLOUD_SERVICE_KEY}" > /tmp/.gsa.key
- gcloud auth activate-service-account --key-file /tmp/.gsa.key
- gcloud config set project "${PROJECT_NAME}" # TODO: change this
script:
- gcloud app deploy
environment:
name: production
url: https://awesome.site
# allow_failure: false
# when: manual
# only:
# - master
deploy:vm-ansible:
stage: deploy
image: dungdm93/ansible:ubuntu16.04
before_script:
- eval "$(ssh-agent -s)"
- ssh-add <(echo "$SSH_PRIVATE_KEY")
# or
# - ssh-add <(cat "$SSH_PRIVATE_KEY_FILE")
script:
- ansible-playbook -i ansible/inventory ansible/playbook.yml -l ${CI_ENVIRONMENT_NAME}
environment:
name: production
url: https://awesome.site
# allow_failure: false
# when: manual
# only:
# - master
deploy:vm-ssh:
stage: deploy
image: dungdm93/openssh:alpine3.6
before_script:
- eval "$(ssh-agent -s)"
- ssh-add <(echo "$SSH_PRIVATE_KEY")
script:
- ssh user@server < scripts.sh
# --or--
# ssh user@server < scripts.sh "bash -s -- arg01 arg02"
environment:
name: production
url: https://awesome.site
# allow_failure: false
# when: manual
# only:
# - master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment