Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix contrib workflow #82

Merged
merged 16 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/ci/build_contrib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ mapfile themes <contrib.txt
# All contrib template should only have one entry point.
for theme in ${themes[@]};
do
theme=${theme:1:${#theme}-2} # remove the /
echo Compiling $theme documentation...
cp contrib/$theme/$theme.tex ./$theme.tex
latexmk $@ -outdir=build $theme.tex
Expand Down
18 changes: 17 additions & 1 deletion .github/ci/gen_cover.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,24 @@ sed -e "s|<options>|red,dark|g" src/doc/cover.template.tex > build/cover-red-dar
sed -e "s|<options>|blue,light|g" src/doc/cover.template.tex > build/cover-blue-light.tex
sed -e "s|<options>|blue,dark|g" src/doc/cover.template.tex > build/cover-blue-dark.tex

# compile covers
latexmk $@ -outdir=build build/cover-*.tex

# merge covers
# copy cover main file with removed last line
cp -f src/doc/cover.tex build/cover.tex
sed -e "s|\\\end{document}||g" src/doc/cover.tex > build/cover.tex

# contrib
for theme in contrib/*;
do
theme=${theme/contrib\//}
echo Compiling $theme ...
cp contrib/$theme/$theme.tex build/$theme.tex
latexmk $@ -outdir=build build/$theme.tex
echo \\includepdf{$theme.pdf}>>build/cover.tex
done

echo \\end{document}>>build/cover.tex

# merge covers
latexmk $@ -outdir=build build/cover.tex
29 changes: 21 additions & 8 deletions .github/workflows/contrib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,19 @@ jobs:
name: checkout code
with:
fetch-depth: 0
- name: get newly contributed package
- name: get newly contributed package (pull request)
if: github.event_name == 'pull_request'
run: |
git diff origin/main --name-only | grep -e 'contrib\/[^/]*\/sjtubeamertheme[^/]*\.ltx' | grep -o -e '\/[^/]*\/' | sed -e "s|\/||g" > contrib.txt
- name: get newly contributed packages (push)
if: github.event_name == 'push'
run: |
git diff origin/main --name-only | grep -e 'contrib\/[^/]*\/sjtubeamertheme[^/]*\.ltx' | grep -o -e '\/[^/]*\/' > contrib.txt
git diff HEAD^ --name-only | grep -e 'contrib\/[^/]*\/sjtubeamertheme[^/]*\.ltx' | grep -o -e '\/[^/]*\/' | sed -e "s|\/||g" > contrib.txt
- name: read contrib package name
id: contrib_name
uses: juliangruber/[email protected]
with:
path: ./contrib.txt
- uses: xu-cheng/texlive-action/full@v1
with:
run: |
Expand All @@ -51,11 +61,11 @@ jobs:
if: github.event_name == 'pull_request'
env:
MESSAGE: |
Thank you for contributing to SJTUBeamer!
Thank you for contributing to SJTUBeamer! The name of your contribution is: {0}

Here is the preview of your contribution documentation.

{0}
{1}
with:
type: create
issue_number: ${{ github.event.number }}
Expand All @@ -64,14 +74,16 @@ jobs:
${{
format(
env.MESSAGE,
steps.contrib_name.outputs.content,
join(fromJSON(steps.contrib_png.outputs.markdown_urls), ' ')
)
}}
name: comment (review requested)
- uses: jungwinter/comment@v1
if: github.event_name == 'push'
env:
MESSAGE: |
###{0}
### {0}

@{1}

Expand All @@ -84,8 +96,9 @@ jobs:
${{
format(
env.MESSAGE,
github.event.push.commits[0].message,
github.event.push.commits[0].author.name,
steps.contrib_name.outputs.content,
github.event.push.commits[0].author[0],
join(fromJSON(steps.contrib_png.outputs.markdown_urls), ' ')
)
}}
}}
name: comment (push)
1 change: 0 additions & 1 deletion .vscode/settings.json

This file was deleted.

99 changes: 58 additions & 41 deletions contrib/sjtug/sjtubeamerthemesjtug.ltx
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
%% ------------------------------------------------------------------------
%% Copyright (C) 2022 LogCreative
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
%% ------------------------------------------------------------------------
% 设置文件元数据
\ProvidesFile{sjtubeamerthemesjtug.ltx}[2022/01/30 SJTUG subtheme for SJTUBeamer]
% 设置组织名称
\institute[SJTU Linux User Group]{上海交通大学 Linux 用户组}
% 设置徽标
Expand All @@ -10,53 +27,53 @@
\definelogo[\getcontribdir{sjtug}/vi]{sjtugtext}{0}{0.8}
% 设置背景为 SJTUG 文字
\setbeamertemplate{background}{
\bgcenterbox{
\sjtugtext[opacity=0.1]
}
\bgcenterbox{
\sjtugtext[opacity=0.1]
}
}
% 判断传递的选项
\if\EqualOption{sjtug}{debug}{true}
\PackageWarning{sjtug}{
You are debugging \CurrentFilePath/\CurrentFile. \MessageBreak
Use lualatex compilation to see the visual reference line
}
\usepackage{lua-visual-debug}
\PackageWarning{sjtug}{
You are debugging \CurrentFilePath/\CurrentFile. \MessageBreak
Use lualatex compilation to see the visual reference line
}
\usepackage{lua-visual-debug}
\fi
% 制作自定标题页
\defbeamertemplate*{title page}{sjtug}[1][]{
\nointerlineskip
\vbox{}
\usebeamercolor{palette primary}
\def\sjtubeamer@logocolor{palette primary.fg}
\begin{tikzpicture}[overlay]
\fill [palette primary.bg] (-0.2*\the\paperwidth,-1*\the\paperheight)
rectangle (1*\the\paperwidth, 0.3*\the\paperheight);
\end{tikzpicture}
\vfill
\color{palette primary.fg}
\hbox to \textwidth{
\hfil
\vbox to 3.5cm{
\vskip3pt
\hbox{\resizebox{2.5cm}{!}{\insertlogo}}
\hbox{\hfill\,\,\sjtugtext[palette primary.fg]\,\hfill}
\vfill
}
\hfil
\vbox to 3.5cm{
\vfill
\hbox{\LARGE\bfseries\inserttitle}
\vskip4pt
\hbox{\large\insertsubtitle}
\vskip2pt
\hbox{\scriptsize\insertauthor}
\hbox{\scriptsize\insertdate}
\vfill
}
\hskip20pt
\hfil
}
\vfill
\nointerlineskip
\vbox{}
\usebeamercolor{palette primary}
\def\sjtubeamer@logocolor{palette primary.fg}
\begin{tikzpicture}[overlay]
\fill [palette primary.bg] (-0.2*\the\paperwidth,-1*\the\paperheight)
rectangle (1*\the\paperwidth, 0.3*\the\paperheight);
\end{tikzpicture}
\vfill
\color{palette primary.fg}
\hbox to \textwidth{
\hfil
\vbox to 3.5cm{
\vskip3pt
\hbox{\resizebox{2.5cm}{!}{\insertlogo}}
\hbox{\hfill\,\,\sjtugtext[palette primary.fg]\,\hfill}
\vfill
}
\hfil
\vbox to 3.5cm{
\vfill
\hbox{\LARGE\bfseries\inserttitle}
\vskip4pt
\hbox{\large\insertsubtitle}
\vskip2pt
\hbox{\scriptsize\insertauthor}
\hbox{\scriptsize\insertdate}
\vfill
}
\hskip20pt
\hfil
}
\vfill
}
% 设置标题页
\defbeamertemplatealias{title page}{my}{sjtug}
Expand Down
17 changes: 13 additions & 4 deletions contrib/sjtug/sjtug.tex
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
\documentclass{ctexbeamer}
% 使用文档推荐不超过 9 页
\documentclass[aspectratio=169]{ctexbeamer} % 使用 16:9 比例
\usetheme[my]{sjtubeamer}
\usemytheme{sjtug}
\usemytheme{sjtug} % 可以添加 debug 参数
\begin{document}
\title{标题}
\subtitle{副标题}
\author{作者}
\maketitle
\begin{frame}
\begin{frame}[fragile] % 含有 codeblock 的页需要使用 fragile 参数
\frametitle{\sjtugtext 主题}
这个主题采用了 SJTUG 的 logo。
这个主题采用了 SJTUG 的 logo,采用了自定义标题页。

\begin{codeblock}[]{使用方法}
\usemytheme{sjtug}
\end{codeblock}

\begin{description}
\item[\texttt{debug}] 参数可以在使用 Lua\LaTeX{} 编译时调用 \texttt{lua-visual-debug} 宏包显示区块边界。
\end{description}
\end{frame}
\makebottom
\end{document}
19 changes: 15 additions & 4 deletions src/build.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
module = "sjtubeamer"

sourcefiledir = "source"
sourcefiles = {"*.ins","*.dtx","vi/","latexmkrc"}
installfiles = {"*.sty","vi/","latexmkrc"}
sourcefiles = {"*.ins","*.dtx","vi/"}
installfiles = {"*.sty","vi/"}

docfiledir = "doc"

Expand Down Expand Up @@ -274,7 +274,18 @@ function checkinit_hook()
gen_snippets()

-- Move generated files to the main directory when it starts to check.
for _,file in pairs(installfiles) do
return cp(file, unpackdir, "../")
for _,src in pairs(installfiles) do
-- patch l3build copying action on directories.
if string.sub(src,-1,-1) == "/" then
local targetdir = "../" .. src
if not direxists(targetdir) then
mkdir(targetdir)
end
cp("", unpackdir .. "/" .. src, targetdir)
else
cp(src, unpackdir, "../")
end
end

return 0
end
10 changes: 5 additions & 5 deletions src/doc/cover.tex
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
\documentclass{article}
\usepackage{pdfpages}
\includepdfset{fitpaper=true,pages=1-last}
\includepdfset{fitpaper=true,pages=1-last,nup=3x3,frame=true}
\begin{document}
\includepdf[nup=3x3,frame=true]{cover-red-dark.pdf}
\includepdf[nup=3x3,frame=true]{cover-red-light.pdf}
\includepdf[nup=3x3,frame=true]{cover-blue-dark.pdf}
\includepdf[nup=3x3,frame=true]{cover-blue-light.pdf}
\includepdf{cover-red-dark.pdf}
\includepdf{cover-red-light.pdf}
\includepdf{cover-blue-dark.pdf}
\includepdf{cover-blue-light.pdf}
\end{document}
2 changes: 1 addition & 1 deletion src/doc/sjtubeamerdevguide.tex
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ \section{Implementation}
\begin{quotation}
\scriptsize

Copyright (C) 2021 SJTUG
Copyright (C) 2021,2022 SJTUG

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 0 additions & 2 deletions src/source/latexmkrc

This file was deleted.