This repository has been archived on 2024-10-01. You can view files and clone it, but cannot push or open issues or pull requests.
badhouseplants-net-old/scripts/upload-media.pl

28 lines
964 B
Perl
Raw Normal View History

#!/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";
# --------------------------------------------------
# -- I'm doing all of it because I can't undestand
# -- how not to send 300Mb to the buildah context
# --------------------------------------------------
chomp($git_branch);
chomp($git_commit_sha);
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;
print "Creating a new hashed dir in the common bucket\n";
2023-04-25 09:18:03 +00:00
print `rclone copy /tmp/$git_commit_sha/static "$common_bucket/$git_commit_sha"` or die;
if ($git_branch eq $main_branch) {
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;
}