Last active
January 10, 2018 01:47
-
-
Save tommyready/58a8638fd469623b7236d95adae66ca0 to your computer and use it in GitHub Desktop.
Python Laravel Deployment Script
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
import git | |
import string | |
import os | |
from os import path | |
from git import * | |
from subprocess import call | |
class gitConnect(): | |
def deploy(self): | |
repo= git.Repo() | |
print('Current Branch: ' + str(repo.active_branch)) | |
o = repo.remotes.origin | |
o.refs | |
repo.heads.master.set_tracking_branch(o.refs.master) | |
print("fetching origin") | |
o.fetch() | |
if(repo.active_branch <> "master"): | |
print("checking out master branch") | |
repo.heads.master.checkout() | |
print("git pull master") | |
o.pull() | |
print("composer update") | |
call(["composer", "update"]) | |
print("optimzing Laravel") | |
call(["php","artisan","optimize"]) | |
print("caching Laravel config") | |
call(["php","artisan","config:cache"]) | |
print("caching Laravel routes") | |
call(["php","artisan","route:cache"]) | |
print("minifying JS and CSS") | |
call(["gulp","--production"]) | |
if __name__ == '__main__': | |
g = gitConnect() | |
g.deploy() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment