Skip to content

Commit

Permalink
Merge pull request #423 from BITNP/dev-fky
Browse files Browse the repository at this point in the history
fix: usability and workflow improvements
  • Loading branch information
fky2015 committed Mar 23, 2024
2 parents 648d5b6 + 598ff77 commit 71f3a03
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 45 deletions.
5 changes: 2 additions & 3 deletions .github/ISSUE_TEMPLATE/release-tracker.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
name: Release Tracker
about: A tracker for release process.
title: '[Release Tracker] <vx.x.x>'
about: A tracker for release process.
title: "[Release Tracker] <vx.x.x>"
labels: Release
---

- [ ] 提升版本号到最新
- [ ] 生成 CHANGELOG
- [ ] 通过单元测试
- [ ] `bithesis` 是否需要更新
- [ ] 上传 CTAN
Expand Down
79 changes: 76 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,23 @@ jobs:
name: cls
path: "*.cls"


publish_templates:
name: Publish ${{ matrix.template }}
runs-on: ubuntu-latest
needs: build

strategy:
matrix:
template: [graduate-thesis, undergraduate-thesis, lab-report, paper-translation, presentation-slide, undergraduate-thesis-en, reading-report]
template:
[
graduate-thesis,
undergraduate-thesis,
lab-report,
paper-translation,
presentation-slide,
undergraduate-thesis-en,
reading-report,
]
include:
- template: graduate-thesis
cls: bithesis
Expand Down Expand Up @@ -82,7 +90,6 @@ jobs:
asset_name: ${{ matrix.template }}.zip
tag: ${{ github.ref }}


publish_cls:
name: Publish ${{ matrix.cls }}
runs-on: ubuntu-latest
Expand All @@ -105,3 +112,69 @@ jobs:
file: ${{ matrix.cls }}.cls
asset_name: ${{ matrix.cls }}.cls
tag: ${{ github.ref }}

publish_pdfs:
name: Generate changelog
runs-on: ubuntu-latest
# Makesure it's the last job.
needs: [build, publish_cls, publish_templates]
outputs:
release_body: ${{ steps.git-cliff.outputs.content }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate a changelog
uses: orhun/git-cliff-action@v3
id: git-cliff
with:
config: cliff.toml
args: -vv --latest --strip header
env:
OUTPUT: CHANGES.md
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v2
- name: Download PDF(s)
uses: actions/download-artifact@v3
with:
name: bithesis

- name: Upload the releases notes
uses: svenstaro/upload-release-action@v2
with:
file: bithesis.pdf
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
overwrite: true
body: |
${{ steps.git-cliff.outputs.content }}
update_changelog:
name: Generate changelog
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate a changelog
uses: orhun/git-cliff-action@v3
with:
config: cliff.toml
args: --verbose
env:
OUTPUT: CHANGELOG.md
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Commit
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
set +e
git add CHANGELOG.md
git commit -m "Update CHANGELOG"
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/BITNP/BIThesis.git main
9 changes: 9 additions & 0 deletions bithesis-doc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,15 @@ \subsubsection{封面选项} \label{sec:cover}
在盲审模式下,不渲染封面。
\end{function}

\begin{function}[added=2024-03-22]{cover/showSpecialTypeBox}
\begin{bitsyntax}[emph={[1]showSpecialTypeBox}]
hideCoverInPeerReview = (*(false)|true*)
\end{bitsyntax}

展示「特殊类型」(研究生模板)的那个信息框。
因为美观原因默认关闭,和研究生院确认过这个信息框重要程度比较低。
\end{function}

\subsubsection{论文基本信息}

\begin{function}{info}
Expand Down
15 changes: 9 additions & 6 deletions bithesis.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -590,8 +590,11 @@
underlineThickness .initial:n = {1pt},
underlineOffset .dim_set:N = \l_@@_cover_underline_offset_dim,
underlineOffset .initial:n = { -10pt },
hideCoverInPeerReview .bool_set:N = \l_@@_style_hide_cover_in_peer_review_bool,
hideCoverInPeerReview .bool_set:N = \l_@@_cover_hide_cover_in_peer_review_bool,
hideCoverInPeerReview .initial:n = {false},
% 研究生的「特殊类型」
showSpecialTypeBox .bool_set:N = \l_@@_cover_show_special_type_box_bool,
showSpecialTypeBox .initial:n = {false}
}
% \end{macrocode}
%
Expand Down Expand Up @@ -1845,7 +1848,7 @@

% 以下内容是「特别类型」的内容,
% 在没有勾选的时候隐藏。
\bool_if:nT {\l_@@_value_international_student_ugp_bool || \l_@@_value_cross_research_bool} {
\bool_if:nT {\l_@@_cover_show_special_type_box_bool || \l_@@_value_international_student_ugp_bool || \l_@@_value_cross_research_bool} {
\begin{minipage}[t]{0.48\textwidth}
\vspace{-12pt}
\begin{flushright}
Expand Down Expand Up @@ -2134,7 +2137,7 @@
% \begin{macrocode}
\DeclareDocumentCommand \MakeCover {}
{
\begin{blindPeerReview}[\l_@@_style_hide_cover_in_peer_review_bool]
\begin{blindPeerReview}[\l_@@_cover_hide_cover_in_peer_review_bool]
\group_begin:

\int_case:nn {\g_@@_thesis_type_int}
Expand Down Expand Up @@ -2384,7 +2387,7 @@
\NewDocumentCommand \MakeOriginality {}
{
\group_begin:
\begin{blindPeerReview}[\l_@@_style_hide_cover_in_peer_review_bool]
\begin{blindPeerReview}[\l_@@_cover_hide_cover_in_peer_review_bool]
\int_case:nn {\g_@@_thesis_type_int}
{
{1}
Expand Down Expand Up @@ -2492,7 +2495,7 @@
% \begin{macrocode}
\NewDocumentCommand \MakePaperBack {}
{
\begin{blindPeerReview}[\l_@@_style_hide_cover_in_peer_review_bool]
\begin{blindPeerReview}[\l_@@_cover_hide_cover_in_peer_review_bool]
\make_paper_back:
\end{blindPeerReview}
}
Expand All @@ -2504,7 +2507,7 @@
% \begin{macrocode}
\NewDocumentCommand \MakeTitle {}
{
\begin{blindPeerReview}[\l_@@_style_hide_cover_in_peer_review_bool]
\begin{blindPeerReview}[\l_@@_cover_hide_cover_in_peer_review_bool]
\@@_make_chinese_title_page:
\@@_make_english_title_page:
\end{blindPeerReview}
Expand Down
111 changes: 78 additions & 33 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# configuration file for git-cliff (0.1.0)
# git-cliff ~ default configuration file
# https://git-cliff.org/docs/configuration
#
# Lines starting with "#" are comments.
# Configuration options are organized into tables and keys.
# See documentation for more information on available options.

[changelog]
# changelog header
header = """
# Changelog\n
All notable changes to this project will be documented in this file.\n
Acronyms:
- LB: lab-report (实验报告模板)
- GT: graduate-thesis (研究生学位论文模板)
Expand All @@ -16,60 +20,101 @@ Acronyms:
**Bolded text highlights its importance.**\n
"""
# template for the changelog body
# https://tera.netlify.app/docs/#introduction
# https://keats.github.io/tera/docs/#introduction
body = """
{%- macro remote_url() -%}
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
{%- endmacro -%}
{% if version %}\
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [unreleased]
{% endif %}\
{% if previous %}\
{% if previous.commit_id %}
[{{ previous.commit_id | truncate(length=7, end="") }}](https://github.com/BITNP/BIThesis/commit/{{ previous.commit_id }})...\
[{{ commit_id | truncate(length=7, end="") }}](https://github.com/BITNP/BIThesis/commit/{{ commit_id }})
{% endif %}\
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/BITNP/BIThesis/commit/{{ commit.id }}))\
{% for group, commits in commits | unique(attribute="id") | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits | unique(attribute="message") %}
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/BITNP/BIThesis/commit/{{ commit.id }}))\
{% if commit.github.username %} by @{{ commit.github.username }}{%- endif -%}
{% if commit.github.pr_number %} in \
[#{{ commit.github.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.github.pr_number }}) \
{%- endif -%}
{% endfor %}
{% endfor %}\n
{%- if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
## New Contributors
{%- endif -%}
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
* @{{ contributor.username }} made their first contribution
{%- if contributor.pr_number %} in \
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
{%- endif %}
{%- endfor %}\n
"""
# remove the leading and trailing whitespace from the template
trim = true
# changelog footer
# template for the changelog footer
footer = """
<!-- generated by git-cliff -->
"""
# remove the leading and trailing s
trim = true
# postprocessors
postprocessors = [
# { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL
]

[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = true
# process each line of a commit as an individual commit
split_commits = true
# regex for preprocessing the commit messages
commit_preprocessors = [
# Replace issue numbers
#{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"},
# Check spelling of the commit with https://github.com/crate-ci/typos
# If the spelling is incorrect, it will be automatically fixed.
#{ pattern = '.*', replace_command = 'typos --write-changes -' },
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "Features"},
{ message = "^fix", group = "Bug Fixes"},
{ message = "^doc", group = "Documentation"},
{ message = "^perf", group = "Performance"},
{ message = "^refactor", group = "Refactor"},
{ message = "^style", group = "Styling"},
{ message = "^test", group = "Testing"},
{ message = "^chore\\(release\\): prepare for", skip = true},
{ message = "^chore", group = "Miscellaneous Tasks"},
{ body = ".*security", group = "Security"},
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
{ message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore\\(deps.*\\)", skip = true },
{ message = "^chore\\(pr\\)", skip = true },
{ message = "^chore\\(pull\\)", skip = true },
{ message = "^chore|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
{ message = "CHANGELOG|changelog", skip = true },
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = false
# glob pattern for matching git tags
tag_pattern = "v[0-9]*"
# regex for matching git tags
# tag_pattern = "v[0-9].*"
# regex for skipping tags
# skip_tags = "v0.1.0-beta.1"
# skip_tags = ""
# regex for ignoring tags
ignore_tags = ".*-alpha-.*"
# sort the tags chronologically
date_order = false
# ignore_tags = ""
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"
# limit the number of commits included in the changelog.
# limit_commits = 42

[remote.github]
owner = "BITNP"
repo = "BIThesis"

0 comments on commit 71f3a03

Please sign in to comment.