mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-20 01:12:36 +00:00
Add version tag injection in the build pipeline
This commit is contained in:
parent
35b624034d
commit
2fdee255fb
@ -7,6 +7,8 @@ sudo chown eqemu:eqemu /home/eqemu/.ccache/ * -R
|
||||
|
||||
git submodule init && git submodule update
|
||||
|
||||
perl utils/scripts/build/tag-version.pl
|
||||
|
||||
mkdir -p build && cd build && cmake -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_LUA=ON -DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING="-Os" -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -G 'Unix Makefiles' .. && make -j$((`nproc`-4))
|
||||
|
||||
curl https://raw.githubusercontent.com/Akkadius/eqemu-install-v2/master/eqemu_config.json --output eqemu_config.json
|
||||
|
||||
61
utils/scripts/build/tag-version.pl
Normal file
61
utils/scripts/build/tag-version.pl
Normal file
@ -0,0 +1,61 @@
|
||||
#!/usr/bin/perl
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
|
||||
open my $fh, '<', './package.json' or die "Can't open file $!";
|
||||
my $package_json = do {
|
||||
local $/;
|
||||
<$fh>
|
||||
};
|
||||
|
||||
my $version = "";
|
||||
sub trim($)
|
||||
{
|
||||
my $string = shift;
|
||||
$string =~ s/^\s+//;
|
||||
$string =~ s/\s+$//;
|
||||
return $string;
|
||||
}
|
||||
|
||||
# manually parse because we can't guarantee json module is available
|
||||
# it's jank but it's quick and dirty
|
||||
# this is only used in the build pipeline
|
||||
foreach my $line (split("\n", $package_json)) {
|
||||
if ($line =~ /version/i) {
|
||||
$version = $line;
|
||||
$version =~ s/version//g;
|
||||
$version =~ s/://g;
|
||||
$version =~ s/"//g;
|
||||
$version =~ s/,//g;
|
||||
$version = trim($version);
|
||||
}
|
||||
}
|
||||
|
||||
print "Version is [" . $version . "]\n";
|
||||
|
||||
# server version file
|
||||
my $version_file_name = "./common/version.h";
|
||||
open my $vfh, '<', $version_file_name or die "Can't open file $!";
|
||||
my $version_file = do {
|
||||
local $/;
|
||||
<$vfh>
|
||||
};
|
||||
|
||||
# write new version
|
||||
my $new_version_file = "";
|
||||
foreach my $line (split("\n", $version_file)) {
|
||||
if ($line =~ /CURRENT_VERSION/i) {
|
||||
my @s = split("\"", $line);
|
||||
if ($#s == 2) {
|
||||
$line =~ s/$s[1]/$version/g;
|
||||
}
|
||||
}
|
||||
|
||||
$new_version_file .= $line . "\n";
|
||||
}
|
||||
|
||||
open(my $wfh, '>', $version_file_name) or die "Could not open file '$version_file_name' $!";
|
||||
print $wfh $new_version_file;
|
||||
close $wfh;
|
||||
|
||||
print $new_version_file;
|
||||
@ -13,6 +13,8 @@ try
|
||||
New-Item -Path "$cwd\win-build-x64" -ItemType Directory
|
||||
}
|
||||
|
||||
perl .\utils\scripts\build\tag-version.pl
|
||||
|
||||
Write-Information -MessageData "Creating build x64" -InformationAction Continue
|
||||
Set-Location -Path "$cwd\win-build-x64"
|
||||
cmake -Wno-dev -G "Visual Studio 17 2022" -A x64 -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_ZLIB=ON "$cwd"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user