Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- # Git Hook that will copy files into deploy-folder when you push into the master branch!
- # remember to make this executable "chmod +x post-receive"
- # 1. read STDIN (Format: "from_commit to_commit branch_name")
- from, to, branch = ARGF.read.split " "
- # 2. Only deploy if master branch was pushed
- if (branch =~ /master$/) == nil
- puts "Received branch #{branch}, not deploying."
- exit
- end
- # 3. Copy files to deploy directory
- deploy_to_dir = File.expand_path('../deploy') # Change this to your deploy-folder path
- `GIT_WORK_TREE="#{deploy_to_dir}" git checkout -f master`
- puts "DEPLOY: master(#{to}) copied to '#{deploy_to_dir}'"
- # 4. TODO: Deployment Tasks
- # i.e.: Run Puppet Apply, Restart Daemons,etc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement