Skip to content

Instantly share code, notes, and snippets.

@pablodgonzalez
Created September 1, 2020 22:04
Show Gist options
  • Select an option

  • Save pablodgonzalez/edc2afcd80eb5b4e49a7b3cc4c5850b2 to your computer and use it in GitHub Desktop.

Select an option

Save pablodgonzalez/edc2afcd80eb5b4e49a7b3cc4c5850b2 to your computer and use it in GitHub Desktop.

Revisions

  1. pablodgonzalez created this gist Sep 1, 2020.
    22 changes: 22 additions & 0 deletions .gitlab-ci.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    before_script:
    - apt-get update -y && apt-get install openssh-client rsync -y
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - echo 'echo "$SSH_PASSPHRASE"' > ~/.ssh/.print_ssh_password
    - chmod 700 ~/.ssh/.print_ssh_password
    - chmod +x ~/.ssh/.print_ssh_password
    - echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
    - chmod 644 ~/.ssh/known_hosts
    - eval $(ssh-agent -s)
    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | DISPLAY=":0.0" SSH_ASKPASS=~/.ssh/.print_ssh_password setsid ssh-add - > /dev/null

    deploy_staging:
    type: deploy
    script:
    - rsync -rzvhWP --delete --delete-excluded --exclude-from 'exclude-files.txt' ./public/ user@host.net:~/public/
    - echo "Staging Ready!"
    environment:
    name: staging
    url: http://www.host.net
    only:
    - development