Created
October 16, 2020 07:41
-
-
Save tmanOC/5a975e9e56ff89dea96527113be77353 to your computer and use it in GitHub Desktop.
A sample pipeline file
This file contains 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
image: php:7.3 #The docker image used for each step | |
pipelines: | |
default: | |
- step: &build-test | |
caches: | |
- composer | |
script: | |
- apt-get update && apt-get install -y unzip | |
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | |
- composer install # unit testing step here | |
branches: # Pipelines that run automatically on a commit to a branch can also be triggered manually | |
master: | |
- step: *build-test | |
- step: | |
name: Deploy to production | |
deployment: production | |
script: | |
- apt-get update -y | |
- apt-get install -y ssh | |
- apt-get install -y git | |
- apt-get install -y rsync | |
- rm -rf images | |
- git ls-files --exclude-standard -oi --directory > files.txt | |
- echo files.txt >> files.txt | |
- rsync -azP --exclude .git/ --exclude-from=files.txt --delete-excluded ./ ubuntu@example.com:/home/ubuntu/example-code | |
- echo 'cd /home/ubuntu/example-code && sudo -s && sudo chmod u+wrx deploy-script.sh && sudo ./deploy-script.sh' | ssh ubuntu@example.com | |
custom: | |
staging: | |
- step: | |
name: Deploy to staging | |
deployment: staging | |
script: | |
- apt-get update -y | |
- apt-get install -y ssh | |
- apt-get install -y git | |
- apt-get install -y rsync | |
- rm -rf images | |
- git ls-files --exclude-standard -oi --directory > files.txt | |
- echo files.txt >> files.txt | |
- rsync -azP --exclude .git/ --exclude-from=files.txt --delete-excluded ./ ubuntu@different-example.com:/home/ubuntu/example-code | |
- echo 'cd /home/ubuntu/example-code && sudo -s && sudo chmod u+wrx deploy-script.sh && sudo ./deploy-script.sh' | ssh ubuntu@different-example.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment