-
Notifications
You must be signed in to change notification settings - Fork 0
/
getinfo.pl
61 lines (49 loc) · 1.43 KB
/
getinfo.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/perl
use strict;
sub getMCVersion(){
open FILE, '<', ".minecraft/pack.toml" || die $!;
my $file=join('',<FILE>);
close FILE;
if ($file=~/minecraft = "([^"]+)"/) {
return $1;
}
}
sub getModPackVersion(){
my $previousversion = $ARGV[1];
if($previousversion =~s/\.(\d+)$//){
return $previousversion.'.'.($1+1);
}
}
sub isItNew(){
my $file1;
if (-e '.minecraft/AsguhoClient-1.0.0.mrpack') {
open FILE, '<', ".minecraft/AsguhoClient-1.0.0.mrpack" || die $!;
$file1=join('',<FILE>);
close FILE;
} else {
print ".minecraft/AsguhoClient-1.0.0.mrpack does not exist!\n";
}
my $file2;
if (-e 'AsguhoClient-1.0.0.mrpackAsguhoClient-1.0.0.mrpack') {
open FILE, '<', "AsguhoClient-1.0.0.mrpackAsguhoClient-1.0.0.mrpack" || die $!;
$file2=join('',<FILE>);
close FILE;
} else {
print "AsguhoClient-1.0.0.mrpack does not exist!\n";
}
# && -e '.minecraft/AsguhoClient-1.0.0.mrpack' && -e 'AsguhoClient-1.0.0.mrpackAsguhoClient-1.0.0.mrpack'
if($file1 eq $file2){
return 'false';
}else {
return 'true';
};
}
if($ARGV[0] eq 'isitnew'){
print "::set-output name=$ARGV[0]::".isItNew();
}
if($ARGV[0] eq 'modpackversion'){
print "::set-output name=$ARGV[0]::".getModPackVersion();
}
if($ARGV[0] eq 'mcversion'){
print "::set-output name=$ARGV[0]::".getMCVersion();
}