Skip to content

Commit

Permalink
publish Git rev
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Nov 19, 2024
1 parent 8892148 commit 15c7813
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion private/publish_gen_index_html.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ function publish_gen_index_html(pkg_name, tagline, outdir)
% "+" avoids picking up cwd of same name
assert(~isempty(pkg), pkg_name + " is not detected as a Matlab directory or package")

%% Git info
repo = gitrepo(pkg.path);
git_txt = "Git branch / commit: " + repo.CurrentBranch.Name + " " + extractBefore(repo.LastCommit.ID, 8);

%% generate docs
readme = fullfile(outdir, "index.html");

Expand All @@ -22,7 +26,8 @@ function publish_gen_index_html(pkg_name, tagline, outdir)

txt = ["<!DOCTYPE html> <head> <title>" + pkg_name + " API</title> <body>", ...
"<h1>" + pkg_name + " API</h1>", ...
tagline, ...
"<p>" + tagline + "</p>", ...
"<p>" + git_txt + "</p>", ...
"<h2>API Reference</h2>"];
fid = fopen(readme, 'w');
fprintf(fid, join(txt, "\n"));
Expand Down

0 comments on commit 15c7813

Please sign in to comment.