badhouseplants-net/scripts/upload-media.pl

19 lines
603 B
Perl
Executable File

#!/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";
chop($git_branch);
chop($git_commit_sha);
if ( $git_branch eq $main_branch) {
print "Syncing to the production bucket\n";
print `rclone sync -P "$common_bucket/$git_commit_sha" "$main_bucket/"`;
} else {
print "Creating a new hashed dir in the common bucket\n";
print `rclone copy -P static "$common_bucket/$git_commit_sha"`;
}