2023-03-29 16:13:55 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
my $git_branch = `git rev-parse --abbrev-ref HEAD`;
|
|
|
|
my $git_commit_sha = `git rev-parse HEAD`;
|
|
|
|
my $main_branch = "main";
|
|
|
|
my $common_bucket = "badhouseplants-minio:/badhouseplants-net";
|
|
|
|
my $main_bucket = "badhouseplants-minio:/badhouseplants-net-main";
|
|
|
|
|
2023-04-24 16:01:13 +00:00
|
|
|
# --------------------------------------------------
|
|
|
|
# -- I'm doing all of it because I can't undestand
|
|
|
|
# -- how not to send 300Mb to the buildah context
|
|
|
|
# --------------------------------------------------
|
2023-04-26 05:07:54 +00:00
|
|
|
chomp($git_branch);
|
|
|
|
chomp($git_commit_sha);
|
2023-04-24 16:01:13 +00:00
|
|
|
|
|
|
|
print `cp -r . /tmp/$git_commit_sha` or die;
|
|
|
|
|
|
|
|
print "Getting the lfs data\n";
|
|
|
|
print `git -C /tmp/$git_commit_sha lfs pull` or die;
|
2023-03-29 16:13:55 +00:00
|
|
|
|
2023-04-24 15:21:41 +00:00
|
|
|
print "Creating a new hashed dir in the common bucket\n";
|
2023-04-24 16:01:13 +00:00
|
|
|
|
2024-05-14 10:48:21 +00:00
|
|
|
print `rclone copy /tmp/$git_commit_sha/src/static "$common_bucket/$git_commit_sha"` or die;
|
2023-04-24 15:21:41 +00:00
|
|
|
|
2023-04-26 05:07:54 +00:00
|
|
|
if ($git_branch eq $main_branch) {
|
2023-03-29 16:13:55 +00:00
|
|
|
print "Syncing to the production bucket\n";
|
2023-04-25 09:18:03 +00:00
|
|
|
print `rclone sync "$common_bucket/$git_commit_sha" "$main_bucket/"` or die;
|
2023-03-29 16:13:55 +00:00
|
|
|
}
|