-
Notifications
You must be signed in to change notification settings - Fork 33
72 lines (62 loc) · 2.26 KB
/
auto-release-typst.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
name: Build and Release Typst document
on:
workflow_dispatch:
inputs:
tag_name:
description: Tag name of release
required: false
schedule:
- cron: "0 0 * * 0"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
- uses: typst-community/setup-typst@v3
with:
typst-version: 0.11.1
cache-dependency-path: oi-wiki-export-typst/oi-wiki.typ
- name: Pre-build operations
env:
GH_TOKEN: ${{ github.token }}
run: |
sudo apt-get install curl git unzip imagemagick libwebp-dev librsvg2-dev fonts-noto-cjk fonts-noto-cjk-extra
sudo apt-get remove fonts-noto-color-emoji
mkdir .fonts
curl -L $(gh api /repos/lxgw/LxgwWenKai/releases/latest -q '.assets[].browser_download_url | select(contains("tar.gz"))') | tar xfz - -C .fonts
git clone https://github.com/OI-wiki/OI-wiki.git --depth=1 --single-branch -b master
cd remark-typst
npm install
cd ..
cd oi-wiki-export-typst
npm install
- name: Build Typst document
run: |
cd oi-wiki-export-typst
node index.js ../OI-wiki
typst compile oi-wiki-export.typ --font-path .fonts
- name: Create Tag
id: create_tag
run: |
tag_name=$(TZ="Asia/Shanghai" date +"v%Y%m%d_%H%M")_typst
if [[ -n "${{github.event.inputs.tag_name}}" ]]; then tag_name=${{github.event.inputs.tag_name}}; fi
git tag $tag_name
git push --tags
echo "tag_name=$tag_name" >> $GITHUB_OUTPUT
- name: Create Release
shell: bash
run: |
set -x
mv ./oi-wiki-export-typst/oi-wiki-export.pdf ./OI-wiki.pdf
gh release create "${{ steps.create_tag.outputs.tag_name }}" ./OI-wiki.pdf
env:
GH_TOKEN: ${{ github.token }}
RELEASE_NAME: "Release ${{ steps.create_tag.outputs.tag_name }}"