<commit_before>#!/usr/bin/perl

use warnings;
use strict;
use File::Basename;


print "prepare codeine...\n";
my $propertiesFile = "src/common/codeine/version.properties";
updateVersionFile();
#es("rm -rf dist");
es("mkdir -p dist");
#es("bounce_minor_version.pl");

my $version = getVersionFull();
my $versionNoDate = getVersionNoDate();
print "java is $ENV{JAVA_HOME}\n";#1.7
print "ant is ant\n";#1.8?
es("ant", 1);
es("cd deployment/http-root/ajs ; npm install");
es("cd deployment/http-root/ajs ; bower install");
es("cd deployment/http-root/ajs ; grunt");
es("rsync -ur deployment/bin dist/");
es("rsync -ur deployment/conf dist/");
es("rsync -ur deployment/project dist/");
es("mkdir -p dist/http-root/ajs");
es("cp -r deployment/http-root/ajs/dist dist/http-root/ajs/app");
es("echo '".getVersionNoDate()."' > dist/build_number.txt");
my $tar = "codeine_".getVersionNoDate().".tar.gz";
es("cd dist; tar -czf ../$tar ./*");
print "tar is ready '$tar' for version $version\n";
my $zip = "codeine_".getVersionNoDate().".zip";
es("cd dist; zip -r ../$zip ./*");
print "zip is ready '$zip' for version $version\n";

if (defined($ENV{RELEASE_AREA}))
{
	my $link = $ENV{RELEASE_AREA}."/codeine.latest.tar";
	es("cp $tar $ENV{RELEASE_AREA}/");
	system("rm $link");
	es("ln -s $tar $link");
}
unless ($ENV{'release-to-github'} eq "true") 
{
	exit(0);
} 
print "Will release new version to Github: $versionNoDate\n";
my $githubUser = $ENV{GITHUB_USER};
my $githubPassword = $ENV{<PASSWORD>};
my $res = r("curl -X POST -u $githubUser:$githubPassword -H \"Content-Type: application/json\" -d '{  \"tag_name\": \"v$versionNoDate\",  \"target_commitish\": \"master\",  \"name\": \"v$versionNoDate\",  \"body\": \"Codeine Release\",  \"draft\": false,  \"prerelease\": true}' https://api.github.com/repos/yami-cd/yami/releases");
print "release returned: $res\n";
$res =~ /\"id\":\s([^,]*)/;
my $id = $1;
print "release id: $id\n";<commit_msg>changed server release to tar<commit_after>#!/usr/bin/perl

use warnings;
use strict;
use File::Basename;


print "prepare codeine...\n";
my $propertiesFile = "src/common/codeine/version.properties";
updateVersionFile();
#es("rm -rf dist");
es("mkdir -p dist");
#es("bounce_minor_version.pl");

my $version = getVersionFull();
my $versionNoDate = getVersionNoDate();
print "java is $ENV{JAVA_HOME}\n";#1.7
print "ant is ant\n";#1.8?
es("ant", 1);
es("cd deployment/http-root/ajs ; npm install");
es("cd deployment/http-root/ajs ; bower install");
es("cd deployment/http-root/ajs ; grunt");
es("rsync -ur deployment/bin dist/");
es("rsync -ur deployment/conf dist/");
es("rsync -ur deployment/project dist/");
es("mkdir -p dist/http-root/ajs");
es("cp -r deployment/http-root/ajs/dist dist/http-root/ajs/dist");
es("echo '".getVersionNoDate()."' > dist/build_number.txt");
my $tar = "codeine_".getVersionNoDate().".tar.gz";
es("cd dist; tar -czf ../$tar ./*");
print "tar is ready '$tar' for version $version\n";
my $zip = "codeine_".getVersionNoDate().".zip";
es("cd dist; zip -r ../$zip ./*");
print "zip is ready '$zip' for version $version\n";

if (defined($ENV{RELEASE_AREA}))
{
	my $link = $ENV{RELEASE_AREA}."/codeine.latest.tar";
	es("cp $tar $ENV{RELEASE_AREA}/");
	system("rm $link");
	es("ln -s $tar $link");
}
unless ($ENV{'release-to-github'} eq "true") 
{
	exit(0);
} 
print "Will release new version to Github: $versionNoDate\n";
my $githubUser = $ENV{GITHUB_USER};
my $githubPassword = $<PASSWORD>{<PASSWORD>};
my $res = r("curl -X POST -u $githubUser:$githubPassword -H \"Content-Type: application/json\" -d '{  \"tag_name\": \"v$versionNoDate\",  \"target_commitish\": \"master\",  \"name\": \"v$versionNoDate\",  \"body\": \"Codeine Release\",  \"draft\": false,  \"prerelease\": true}' https://api.github.com/repos/yami-cd/yami/releases");
print "release returned: $res\n";
$res =~ /\"id\":\s([^,]*)/;
my $id = $1;
print "release id: $id\n";
{'fraction_non_alphanumeric': 0.2299794661190965, 'fraction_numerical': 0.003593429158110883, 'mean_word_length': 4.705710102489019, 'pattern_counts': {'":': 14, '<': 6, '<?xml version=': 0, '>': 8, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5019845', 'n_tokens_mistral': 1489, 'n_tokens_neox': 1439, 'n_words': 349}