Skip to content

Commit 9ba188e

Browse files
authored
Merge pull request #426 from YDX-2147483647/main
CI: Upload to CTAN and minor fixes
2 parents dd3768a + 28b2808 commit 9ba188e

File tree

4 files changed

+41
-32
lines changed

4 files changed

+41
-32
lines changed

.github/ISSUE_TEMPLATE/release-tracker.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ labels: Release
77

88
- [ ] 提升版本号到最新
99
- [ ] 通过单元测试
10-
- [ ] `bithesis` 是否需要更新
11-
- [ ] 上传 CTAN
1210
- [ ] 上传新的模板到 Overleaf
1311
- [ ] 模板是否需要更新
1412
- [ ] 发布新的 Release

.github/workflows/release.yml

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: Release
22

33
on:
4-
push:
5-
tags:
6-
- "*.*.*"
4+
release:
5+
types:
6+
- published
77

88
jobs:
99
build:
@@ -113,7 +113,7 @@ jobs:
113113
asset_name: ${{ matrix.cls }}.cls
114114
tag: ${{ github.ref }}
115115

116-
publish_pdfs:
116+
update_changelog:
117117
name: Generate changelog
118118
runs-on: ubuntu-latest
119119
# Makesure it's the last job.
@@ -152,29 +152,38 @@ jobs:
152152
body: |
153153
${{ steps.git-cliff.outputs.content }}
154154
155-
update_changelog:
156-
name: Generate changelog
155+
upload_to_ctan:
156+
name: Upload to CTAN
157157
runs-on: ubuntu-latest
158+
needs: build
159+
if: ${{ ! github.event.release.prerelease }}
158160
steps:
159-
- name: Checkout
160-
uses: actions/checkout@v4
161-
with:
162-
fetch-depth: 0
163-
164-
- name: Generate a changelog
165-
uses: orhun/git-cliff-action@v3
161+
- uses: actions/checkout@v4
162+
- name: Download bithesis.pdf
163+
uses: actions/download-artifact@v3
166164
with:
167-
config: cliff.toml
168-
args: --verbose
169-
env:
170-
OUTPUT: CHANGELOG.md
171-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
172-
173-
- name: Commit
165+
name: bithesis
166+
- run: make pkg-only
167+
- name: Determine version
168+
id: version
174169
run: |
175-
git config user.name 'github-actions[bot]'
176-
git config user.email 'github-actions[bot]@users.noreply.github.com'
177-
set +e
178-
git add CHANGELOG.md
179-
git commit -m "Update CHANGELOG"
180-
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/BITNP/BIThesis.git main
170+
version=${{ github.event.release.tag_name }}
171+
echo "number=$(echo $version | sed 's/^v//')" >> "$GITHUB_OUTPUT"
172+
echo "date=$(date '+%Y-%m-%d')" >> "$GITHUB_OUTPUT"
173+
- name: Upload to CTAN
174+
uses: paolobrasolin/ctan-submit-action@v1
175+
with:
176+
action: upload
177+
file_path: bithesis.zip
178+
fields: |
179+
update: "true"
180+
pkg: bithesis
181+
version: ${{ steps.version.outputs.number }} ${{ steps.version.outputs.date }}
182+
author: Feng Kaiyu
183+
184+
uploader: Feng Kaiyu
185+
- name: Report
186+
run: >
187+
echo "🎉 Successfully upload
188+
${{ steps.version.outputs.number }} (${{ steps.version.outputs.date }})
189+
to [CTAN](https://www.ctan.org/pkg/bithesis)." >> "$GITHUB_STEP_SUMMARY"

DEVELOPMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ make doc
7878
## 打包
7979

8080
- `make overleaf version=X.X.X` 可以生成上传 overleaf 所需要的 zip 文件。
81-
- `make pkg` 可以生成上传 CTAN 所需要的 zip 文件。
81+
- `make pkg` 可以生成上传 CTAN 所需要的 zip 文件。若已有手册而不想重新编译,可 `make pkg-only`。(同样被用于 GitHub Actions)
8282
- `make grad version=X.X.X` 可以生成用作研究生院官网附件的 zip 文件。
8383

8484
## 上传 Overleaf 与更新

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ else
2121
endif
2222

2323

24-
.PHONY: all cls doc clean FORCE_MAKE copy
24+
.PHONY: all cls doc clean FORCE_MAKE copy pkg pkg-only
2525

2626
$(PACKAGE).pdf: cls FORCE_MAKE
2727
@$(LATEXMK) -xelatex $(PACKAGE).dtx
@@ -94,13 +94,15 @@ dev:
9494
dev-doc:
9595
ls bithesis.dtx | entr -s 'make clean-all && yes y | make doc && open bithesis.pdf'
9696

97-
pkg: doc
97+
pkg-only:
9898
rm -rf ./bithesis ./bithesis.zip
9999
mkdir bithesis
100-
cp bithesis.{ins,dtx,pdf} ./README*.md ./contributing*.md ./bithesis
100+
cp bithesis.ins bithesis.dtx bithesis.pdf ./README*.md ./contributing*.md ./bithesis
101101
mv ./bithesis/README-bithesis.md ./bithesis/README.md
102102
zip -r bithesis.zip bithesis
103103

104+
pkg: doc pkg-only
105+
104106
GRAD_DEST_DIR = ./BIThesis-graduate-thesis-template
105107

106108
grad: doc copy FORCE_MAKE

0 commit comments

Comments
 (0)