mirror of
https://github.com/Qortal/qortal.git
synced 2025-02-11 09:45:50 +00:00
updates/fixes to publish-auto-update.pl
This commit is contained in:
parent
d6cf45b311
commit
4991618f19
@ -69,7 +69,8 @@ die("Can't calculate SHA256 of ${project}.update\n") unless $sha256 =~ m/(\S{64}
|
|||||||
chomp $sha256;
|
chomp $sha256;
|
||||||
|
|
||||||
# long-form commit hash of HEAD on auto-update branch
|
# long-form commit hash of HEAD on auto-update branch
|
||||||
my $update_hash = `git rev-parse refs/heads/auto-update-${commit_hash}`;
|
#my $update_hash = `git rev-parse refs/heads/auto-update-${commit_hash}`;
|
||||||
|
my $update_hash = `git rev-parse origin/auto-update-${commit_hash}`;
|
||||||
die("Can't find commit hash for HEAD on auto-update-${commit_hash} branch\n") if ! defined $update_hash;
|
die("Can't find commit hash for HEAD on auto-update-${commit_hash} branch\n") if ! defined $update_hash;
|
||||||
chomp $update_hash;
|
chomp $update_hash;
|
||||||
|
|
||||||
@ -132,11 +133,57 @@ my $signed_tx = `curl --silent -H "accept: text/plain" -H "Content-Type: applica
|
|||||||
die("Can't sign raw transaction:\n$signed_tx\n") unless $signed_tx =~ m/^\w{390,410}$/; # +90ish longer than $raw_tx
|
die("Can't sign raw transaction:\n$signed_tx\n") unless $signed_tx =~ m/^\w{390,410}$/; # +90ish longer than $raw_tx
|
||||||
printf "\nSigned transaction:\n%s\n", $signed_tx;
|
printf "\nSigned transaction:\n%s\n", $signed_tx;
|
||||||
|
|
||||||
# Check we can actually fetch update
|
# Get the origin URL - So that we will be able to TEST the obtaining of the qortal.update...
|
||||||
my $origin = `git remote get-url origin`;
|
my $origin = `git remote get-url origin`;
|
||||||
die("Unable to get github url for 'origin'?\n") unless $origin && $origin =~ m/:(.*)\.git$/;
|
chomp $origin; # Remove any trailing newlines
|
||||||
my $repo = $1;
|
die("Unable to get github url for 'origin'?\n") unless $origin;
|
||||||
|
|
||||||
|
# Debug: Print the origin URL
|
||||||
|
print "Full Origin URL: $origin\n";
|
||||||
|
|
||||||
|
# Extract the repository path (e.g., Qortal/qortal) NOTE - github is case-sensitive with repo names
|
||||||
|
my $repo;
|
||||||
|
if ($origin =~ m/[:\/]([\w\-]+\/[\w\-]+)\.git$/) {
|
||||||
|
$repo = $1;
|
||||||
|
print "Extracted direct repository path: $repo\n";
|
||||||
|
if ($repo =~ m/^qortal\//i) {
|
||||||
|
$repo =~ s/^qortal\//Qortal\//;
|
||||||
|
print "Corrected repository path capitalization: $repo\n";
|
||||||
|
}
|
||||||
|
print "Please verify the direct repository path. Current: '$repo'\n";
|
||||||
|
print "If incorrect, input the correct direct repository path (e.g., 'Qortal/qortal' or 'bob/qortal').NOTE - github is CASE SENSITIVE for repository urls... Press Enter to keep the extracted version: ";
|
||||||
|
my $input = <STDIN>;
|
||||||
|
if ($input =~ m/^qortal\//i) {
|
||||||
|
$input =~ s/^qortal\//Qortal\//;
|
||||||
|
print "Corrected repository path capitalization: $repo\n";
|
||||||
|
}
|
||||||
|
chomp $input;
|
||||||
|
$repo = $input if $input; # Update repo if user provides input
|
||||||
|
|
||||||
|
} else {
|
||||||
|
# Default to qortal/qortal if extraction fails
|
||||||
|
$repo = "Qortal/qortal";
|
||||||
|
print "Failed to extract repository path from origin URL. Using default: $repo\n";
|
||||||
|
|
||||||
|
# Prompt the user for confirmation or input
|
||||||
|
print "Please verify the repository path. Current: '$repo'\n";
|
||||||
|
print "If incorrect, input the correct repository path (e.g., 'Qortal/qortal' or 'BobsCodeburgers/qortal'). NOTE - GitHub is CASE SENSITIVE for repository urls... Press Enter to keep the default: ";
|
||||||
|
my $input = <STDIN>;
|
||||||
|
if ($input =~ m/^qortal\//i) {
|
||||||
|
$input =~ s/^qortal\//Qortal\//;
|
||||||
|
print "Corrected repository path capitalization: $repo\n";
|
||||||
|
}
|
||||||
|
chomp $input;
|
||||||
|
$repo = $input if $input; # Update repo if user provides input
|
||||||
|
}
|
||||||
|
|
||||||
|
# Debug: Print the final repository path
|
||||||
|
print "Final direct repository path: $repo\n";
|
||||||
|
|
||||||
|
# Construct the update URL
|
||||||
my $update_url = "https://github.com/${repo}/raw/${update_hash}/${project}.update";
|
my $update_url = "https://github.com/${repo}/raw/${update_hash}/${project}.update";
|
||||||
|
print "Final update URL: $update_url\n";
|
||||||
|
|
||||||
|
|
||||||
my $fetch_result = `curl --silent -o /dev/null --location --range 0-1 --head --write-out '%{http_code}' --url ${update_url}`;
|
my $fetch_result = `curl --silent -o /dev/null --location --range 0-1 --head --write-out '%{http_code}' --url ${update_url}`;
|
||||||
die("\nUnable to fetch update from ${update_url}\n") if $fetch_result ne '200';
|
die("\nUnable to fetch update from ${update_url}\n") if $fetch_result ne '200';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user