Forked from lsmith77/platform.sh - gitlab autodeploy
Created
December 8, 2017 15:47
-
-
Save doxt3r/c1f8437360fa4cf154558bb2948afdbf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /dev/ci/setup_ssh.sh | |
#!/usr/bin/env bash | |
which ssh-agent || (apt-get update -y && apt-get install openssh-client -y) | |
eval $(ssh-agent -s) | |
ssh-add <(echo "$PLATFORMSH_DEPLOY_KEY") | |
mkdir -p ~/.ssh | |
[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config | |
# .gitlab-ci.yml | |
# deploy to platform.sh staging - develop environment | |
deploy_staging_develop: | |
stage: deploy | |
only: [ develop ] | |
environment: | |
name: Staging - develop | |
url: https://develop-XXX.eu.platform.sh/ | |
dependencies: [ test_app ] | |
script: | |
- source dev/ci/setup_ssh.sh | |
- git remote -v | grep platform || git remote add platform [email protected]:XXX.git | |
- git checkout develop | |
- git pull --rebase | |
- git push platform develop | |
# deploy to platform.sh staging - master environment | |
deploy_staging_master: | |
stage: deploy | |
only: [ master ] | |
environment: | |
name: Staging - master | |
url: https://master-XXX.eu.platform.sh/ | |
dependencies: [ test_app ] | |
script: | |
- source dev/ci/setup_ssh.sh | |
- git remote -v | grep platform || git remote add platform [email protected]:XXX.git | |
- git checkout master | |
- git pull --rebase | |
- git push platform master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment