parent
5580beb497
commit
0f296e5e26
2 changed files with 0 additions and 55 deletions
@ -1,54 +0,0 @@ |
|||||||
package MJB::Web::Task::DeployBlog; |
|
||||||
use Mojo::Base 'MJB::Web::Task', -signatures; |
|
||||||
use Mojo::File qw( curfile ); |
|
||||||
use File::Copy::Recursive qw( dircopy ); |
|
||||||
use IPC::Run3; |
|
||||||
|
|
||||||
sub run ( $job, $blog_id ) { |
|
||||||
$job->note( _mds_template => 'build_static' ); |
|
||||||
|
|
||||||
my $build_dir = $job->checkout_repo( $blog_id ); |
|
||||||
my $blog = $job->app->db->blog( $blog_id ); |
|
||||||
|
|
||||||
$job->note( is_clone_complete => 1 ); |
|
||||||
|
|
||||||
# Show the user the commit we're on. |
|
||||||
$job->system_command( [ 'git', '-C', $build_dir->child('src')->to_string, 'log', '-1' ] ); |
|
||||||
|
|
||||||
$build_dir->child('build')->make_path; |
|
||||||
|
|
||||||
|
|
||||||
$job->system_command( [qw( podman run -ti --rm -v .:/srv/jekyll -e JEKYLL_ROOTLESS=1 docker.io/jekyll/jekyll jekyll build ) ], { |
|
||||||
chdir => $build_dir->child('src')->to_string, |
|
||||||
}); |
|
||||||
|
|
||||||
$job->process_webroot( |
|
||||||
$blog, |
|
||||||
$build_dir->child('src')->child('_site')->to_string, |
|
||||||
$build_dir->child('build')->to_string |
|
||||||
); |
|
||||||
|
|
||||||
#== |
|
||||||
# Build Site Config |
|
||||||
#== TODO: There is two different files made here, one is done by ansible -- pick one, |
|
||||||
# probably this one. |
|
||||||
Mojo::File->new($build_dir)->child('build')->child('site.yml')->spurt( |
|
||||||
YAML::Dump({ |
|
||||||
domain => $blog->domain->name, |
|
||||||
www_dir => "$build_dir/build/", |
|
||||||
}) |
|
||||||
); |
|
||||||
|
|
||||||
$job->note( is_build_complete => 1 ); |
|
||||||
|
|
||||||
# Go to the build directory and make $build_dir/. |
|
||||||
$ENV{MARKDOWNSITE_CONFIG} = Mojo::File->new($build_dir->to_string)->child('build')->child('site.yml'); |
|
||||||
$job->system_command( [ 'ansible-playbook', '/etc/ansible/deploy-website.yml' ] ); |
|
||||||
|
|
||||||
|
|
||||||
$job->note( is_deploy_complete => 1 ); |
|
||||||
$job->finish( ); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
1; |
|
||||||
Loading…
Reference in new issue