forked from BITNP/BIThesis
-
Notifications
You must be signed in to change notification settings - Fork 0
261 lines (239 loc) · 8.56 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
name: Release
on:
release:
types:
- published
jobs:
build:
name: build bithesis manual
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: xu-cheng/texlive-action@v2
with:
scheme: full
run: |
apk add make msttcorefonts-installer fontconfig
update-ms-fonts
fc-cache -f
make doc
make handbooks
- name: Upload bithesis.pdf for later usage.
uses: actions/upload-artifact@v4
with:
name: bithesis
path: bithesis.pdf
- name: Upload handbooks for later usage.
uses: actions/upload-artifact@v4
with:
name: handbooks
path: "handbook/*.pdf"
- name: Upload *.cls for later usage.
uses: actions/upload-artifact@v4
with:
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,
]
include:
- template: graduate-thesis
label: 硕博·学位论文
- template: undergraduate-thesis
label: 本科·毕业设计·论文
- template: lab-report
label: 实验报告
- template: paper-translation
label: 本科·毕业设计·外文翻译
- template: presentation-slide
label: 演示文档
- template: undergraduate-thesis-en
label: 本科·毕业设计·论文(全英文专业)
- template: reading-report
label: 本科·读书报告
steps:
- uses: actions/checkout@v4
- name: Download bithesis.pdf
uses: actions/download-artifact@v4
with:
name: bithesis
- name: Download `*.cls`
uses: actions/download-artifact@v4
with:
name: cls
- name: Copy manual to the template folder.
run: |
mv bithesis.pdf ./templates/${{ matrix.template }}
make copy-only
- name: Install zip
uses: montudor/action-zip@v1
- name: Zip files under ./${{ matrix.template }}
run: zip -qq -r ./${{ matrix.template }}.zip ./${{ matrix.template }}
working-directory: ./templates
- name: Upload ${{ matrix.template }}.zip to release
run: |
gh release upload ${{ github.event.release.tag_name }} \
"./templates/${{ matrix.template }}.zip#模板包·${{ matrix.label }} — ${{ matrix.template }}.zip"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish_cls:
name: Publish ${{ matrix.cls }}
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
cls:
- name: bithesis
label: 论文
- name: bitreport
label: 实验报告
- name: bitbeamer
label: 幻灯片
steps:
- uses: actions/checkout@v4
- name: Download *.cls
uses: actions/download-artifact@v4
with:
name: cls
- name: Upload ${{ matrix.cls.name }}.cls to release
run: |
gh release upload ${{ github.event.release.tag_name }} \
"${{ matrix.cls.name }}.cls#文档类·${{ matrix.cls.label }} — ${{ matrix.cls.name }}.cls(用于升级替换)"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release_notes:
name: Populate release notes with latest changelog and PDFs
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@v4
id: git-cliff
with:
config: cliff.toml
args: -vv ${{ github.event.release.prerelease && '--unreleased' || '--latest' }} --strip header
env:
OUTPUT: CHANGES.md
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- name: Download bithesis.pdf
uses: actions/download-artifact@v4
with:
name: bithesis
- name: Upload bithesis.pdf and changelog
uses: svenstaro/upload-release-action@v2
with:
file: bithesis.pdf
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
overwrite: true
body: |
> [!TIP]
> 若是初次使用,可先参考**快速使用指南**([本科][undergraduate-handbook]/[硕博][graduate-handbook])或者 [Wiki 网站](https://bithesis.bitnp.net/)。有需要再进一步参考[详细配置手册`bithesis.pdf`][bithesis-pdf]。
[undergraduate-handbook]: ${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/undergraduate-handbook.pdf
[graduate-handbook]: ${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/graduate-handbook.pdf
[bithesis-pdf]: ${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/bithesis.pdf
${{ steps.git-cliff.outputs.content }}
- name: Download handbooks
uses: actions/download-artifact@v4
with:
name: handbooks
path: handbook
- name: Upload handbooks
run: |
gh release upload ${{ github.event.release.tag_name }} \
"handbook/undergraduate-handbook.pdf#快速使用指南·本科"
gh release upload ${{ github.event.release.tag_name }} \
"handbook/graduate-handbook.pdf#快速使用指南·硕博"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
upload_to_ctan:
name: Upload to CTAN
runs-on: ubuntu-latest
needs: build
if: ${{ ! github.event.release.prerelease }}
steps:
- uses: actions/checkout@v4
- name: Download bithesis.pdf
uses: actions/download-artifact@v4
with:
name: bithesis
- run: make pkg-only
- name: Determine version
id: version
run: |
version=${{ github.event.release.tag_name }}
echo "number=$(echo $version | sed 's/^v//')" >> "$GITHUB_OUTPUT"
echo "date=$(date '+%Y-%m-%d')" >> "$GITHUB_OUTPUT"
- name: Upload to CTAN
uses: paolobrasolin/ctan-submit-action@v1
with:
action: upload
file_path: bithesis.zip
fields: |
update: "true"
pkg: bithesis
version: ${{ steps.version.outputs.number }} ${{ steps.version.outputs.date }}
author: Feng Kaiyu
email: [email protected]
uploader: Feng Kaiyu
- name: Report
run: >
echo "🎉 Successfully upload
${{ steps.version.outputs.number }} (${{ steps.version.outputs.date }})
to [CTAN](https://www.ctan.org/pkg/bithesis)." >> "$GITHUB_STEP_SUMMARY"
changelog:
name: Update CHANGELOG
runs-on: ubuntu-latest
if: ${{ ! github.event.release.prerelease }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.repository.default_branch }}
- name: Update CHANGELOG
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --verbose
env:
OUTPUT: CHANGELOG.md
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create a PR
# Changes must be made through the merge queue, therefore a PR is necessary.
id: pr
uses: peter-evans/create-pull-request@v7
with:
commit-message: Update CHANGELOG for ${{ github.event.release.tag_name }}
title: Update CHANGELOG for ${{ github.event.release.tag_name }}
# Ignore binaries installed by git-cliff-action.
add-paths: CHANGELOG.md
- name: Report status
run: |
echo "[Pull request #${{ steps.pr.outputs.pull-request-number }}](${{ steps.pr.outputs.pull-request-url }}) is created to update CHANGELOG." >> "$GITHUB_STEP_SUMMARY"
- name: Merge the PR
run: |
gh pr merge ${{ steps.pr.outputs.pull-request-number }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}