Skip to content

Commit

Permalink
Minor Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jgeluk committed May 6, 2021
1 parent ac074a5 commit 92ebdcb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0
0.1
33 changes: 21 additions & 12 deletions latex-lib/.latexmkrc
Original file line number Diff line number Diff line change
Expand Up @@ -196,28 +196,39 @@ sub starts_with {
return substr($_[0], 0, length($_[1])) eq $_[1];
}

sub getVersionSuffix() {
sub getVersionString() {
my $prefix = '';
my $suffix = '';
if (! $ENV{'GITHUB_RUN_NUMBER'}) {
$suffix = "${suffix}.$ENV{'USER'}";
#
# If we are running in a job that is being triggered by a push with a tag then
# assume that the tag is the version number
#
if (starts_with($ENV{'GITHUB_REF'}, 'refs/tags/')) {
my $tag = $ENV{'GITHUB_REF'};
$tag =~ 'refs/tags/';
$suffix = "${tag}";
} else {
if (starts_with($ENV{'GITHUB_REF'}, 'refs/tags/')) {
my $tag = $ENV{'GITHUB_REF'};
$tag =~ 'refs/tags/';
$suffix = "${suffix}.${tag}";
#
# Else, read the version number from the VERSION file and add the
# job run number at the end so that it looks like '0.1.123' or so.
# If run locally, then use the userid instead: '0.1.youruserid'.
#
$suffix = readVersion();
if (! $ENV{'GITHUB_RUN_NUMBER'}) {
$suffix = "${suffix}.$ENV{'USER'}";
} else {
$suffix = "${suffix}.$ENV{'GITHUB_RUN_NUMBER'}";
}
}
my $branchName = getCurrentBranchName();
if ($branchName ~~ ['main', 'master']) {
if ($branchName ~~ ['main', 'master', 'HEAD']) {
print "No git branch name in the name of the generated PDF file because we're on ${branchName}\n";
} elsif ($branchName eq '') {
;
} else {
$suffix = "${suffix}-${branchName}";
}
return ${suffix};
return "${prefix}${suffix}";
}

($document_file, $document_name) = findMainDoc();
Expand Down Expand Up @@ -298,9 +309,7 @@ $jobname =~ s/--/-/g ;
$jobname = "${document_customer_code}${jobname}" ;
$jobname =~ s/--/-/g ;

$latex_document_version = readVersion();
$latex_document_version_suffix = getVersionSuffix();
$latex_document_version = "${latex_document_version}${latex_document_version_suffix}";
$latex_document_version = getVersionString();
$versionWithDashes = $latex_document_version;
$versionWithDashes =~ tr/./-/s;
print "Document Version: $latex_document_version...\n";
Expand Down

0 comments on commit 92ebdcb

Please sign in to comment.