Last active
July 3, 2022 16:42
-
-
Save Chew/b2c9b7a51179eeb14744a7c0210de05f to your computer and use it in GitHub Desktop.
[WIP] DeployBoy - A simple way to automate Rails deployment, efficiently
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
# Pull from GitHub | |
puts "Pulling..." | |
pull = `git pull` | |
if pull.include? "Already up to date." | |
puts "Already up to date, nothing to deploy." | |
exit | |
end | |
# Gem changes occur, we must bundle install | |
if pull.include? "Gemfile" | |
print "Updating Gems..." | |
`bundle install` | |
puts " Done!" | |
end | |
# Did package.json or yarn.lock change? | |
# Install and recompile assets | |
if pull.include?("yarn.lock") || pull.include?("package.json") | |
print "Updating dependencies..." | |
`yarn install --check-files` | |
`rake assets:precompile` | |
puts " Done!" | |
end | |
# Did assets change? precompile | |
if pull.include?("assets") || pull.include?("javascript") | |
print "Compiling assets..." | |
`rake assets:precompile` | |
puts " Done!" | |
end | |
`rails restart` | |
# Done! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment