Skip to content

Instantly share code, notes, and snippets.

@tmanOC
Created October 16, 2020 07:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmanOC/5a975e9e56ff89dea96527113be77353 to your computer and use it in GitHub Desktop.
Save tmanOC/5a975e9e56ff89dea96527113be77353 to your computer and use it in GitHub Desktop.
A sample pipeline file
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