Merge pull request 'Staging環境へのデプロイを行うタスクを追加' (#6) from add-deploy-rake-task into master
Reviewed-on: #6
This commit is contained in:
commit
624ff3f47c
|
@ -1,3 +1,4 @@
|
|||
.hugo_build.lock
|
||||
assets
|
||||
resources
|
||||
public
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env rake
|
||||
|
||||
def os
|
||||
@os ||= (
|
||||
host_os = RbConfig::CONFIG['host_os']
|
||||
case host_os
|
||||
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
||||
:windows
|
||||
when /darwin|mac os/
|
||||
:macosx
|
||||
when /linux/
|
||||
:linux
|
||||
when /solaris|bsd/
|
||||
:unix
|
||||
else
|
||||
:unknown
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
desc 'Preparation for Generating the HTML Pages'
|
||||
task :prep do
|
||||
cd 'content/' do
|
||||
if os == :linux
|
||||
sh 'find . -type f -name "*.mde" | xargs --no-run-if-empty rm || true'
|
||||
sh 'find . -type f -name "*.md-e" | xargs --no-run-if-empty rm || true'
|
||||
else
|
||||
sh 'find . -type f -name "*.mde" | xargs rm || true'
|
||||
sh 'find . -type f -name "*.md-e" | xargs rm || true'
|
||||
end
|
||||
end
|
||||
|
||||
cd 'public' do
|
||||
sh 'rm -rf *'
|
||||
end
|
||||
end
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env rake
|
||||
|
||||
require 'find'
|
||||
|
||||
desc 'Deploy the hugo contents to the server'
|
||||
task :stag => [ :prep ] do
|
||||
sh 'hugo -e staging -v --minify'
|
||||
|
||||
sh 'find public -type f -name "*.gz" -delete'
|
||||
|
||||
sh 'find public/ -type f | egrep "\.(css|js|png|jpg|html|JPG|PNG|CSS|JS|HTML)$" | xargs -n 1 -i% -P 0 sh -c "cp % %.bk && gzip % && mv %.bk %"'
|
||||
|
||||
sh 'ssh -p 10022 webadm@10.0.1.166 "rm -rf /var/www/test-everun/*"'
|
||||
sh 'rsync -e "ssh -p 10022" -rltvz --omit-dir-times --delete public/ webadm@10.0.1.166:/var/www/test-everun'
|
||||
end
|
Loading…
Reference in New Issue