-
Notifications
You must be signed in to change notification settings - Fork 8
executable file
·108 lines (105 loc) · 5 KB
/
trpl.yaml
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
name: Build for TRPL
on:
push:
branches:
- master
schedule:
- cron: '0 6 * * *'
workflow_dispatch:
repository_dispatch:
jobs:
build_and_deploy:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- name: Update rustup
run: rustup self update
- name: Install Rust
run: |
rustup set profile minimal
rustup toolchain install 1.74.1 -c rust-docs
rustup default 1.74.1
- name: Install mdbook
run: |
mkdir bin
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.36/mdbook-v0.4.36-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
echo "$(pwd)/bin" >> ${GITHUB_PATH}
- name: Clone trpl book
run: git clone https://x-access-token:${GITHUB_TOKEN}@github.com/rust-lang/book.git trpl-en
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Clone trpl book
run: git clone https://x-access-token:${GITHUB_TOKEN}@github.com/KaiserY/trpl-zh-cn.git trpl-zh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install mdbook-typst-pdf
run: |
curl -sL -o bin/mdbook-typst-pdf https://github.com/KaiserY/mdbook-typst-pdf/releases/download/0.1.2/mdbook-typst-pdf-x86_64-unknown-linux-gnu
chmod +x bin/mdbook-typst-pdf
echo "$(pwd)/bin" >> ${GITHUB_PATH}
- name: Install font
run: |
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
sudo apt-get -y install msttcorefonts
mkdir fonts
mkdir -p ~/.local/share/fonts
curl -sL -o Noto_Sans.zip https://github.com/notofonts/latin-greek-cyrillic/releases/download/NotoSans-v2.013/NotoSans-v2.013.zip
unzip Noto_Sans.zip -d fonts/Noto_Sans
curl -sL -o Noto_Sans_SC.zip https://github.com/notofonts/noto-cjk/releases/download/Sans2.004/08_NotoSansCJKsc.zip
unzip Noto_Sans_SC.zip -d fonts/Noto_Sans_SC
curl -sL -o Noto_Sans_Mono.zip https://github.com/notofonts/latin-greek-cyrillic/releases/download/NotoSansMono-v2.014/NotoSansMono-v2.014.zip
unzip Noto_Sans_Mono.zip -d fonts/Noto_Sans_Mono
curl -sL -o Noto_Sans_KR.zip https://github.com/notofonts/noto-cjk/releases/download/Sans2.004/07_NotoSansCJKkr.zip
unzip Noto_Sans_KR.zip -d fonts/Noto_Sans_KR
curl -sL -o Noto_Sans_Thai.zip https://github.com/notofonts/thai/releases/download/NotoSansThai-v2.002/NotoSansThai-v2.002.zip
unzip Noto_Sans_Thai.zip -d fonts/Noto_Sans_Thai
curl -sL -o Noto_Sans_Arabic.zip https://github.com/notofonts/arabic/releases/download/NotoNaskhArabic-v2.018/NotoNaskhArabic-v2.018.zip
unzip Noto_Sans_Arabic.zip -d fonts/Noto_Sans_Arabic
curl -sL -o Noto_Sans_Devanagari.zip https://github.com/notofonts/devanagari/releases/download/NotoSansDevanagari-v2.004/NotoSansDevanagari-v2.004.zip
unzip -: Noto_Sans_Devanagari.zip -d fonts/Noto_Sans_Devanagari
curl -sL -o NotoColorEmoji.ttf https://github.com/googlefonts/noto-emoji/raw/main/fonts/NotoColorEmoji.ttf
mv NotoColorEmoji.ttf fonts/NotoColorEmoji.ttf
curl -sL -o times_sans_serif.zip https://dl.dafont.com/dl/?f=times_sans_serif
unzip times_sans_serif.zip -d fonts/times_sans_serif
curl -sOL https://github.com/notofonts/hebrew/releases/download/NotoSansHebrew-v2.003/NotoSansHebrew-v2.003.zip
unzip -: NotoSansHebrew-v2.003.zip
mv -v NotoSansHebrew fonts/
mv fonts/* ~/.local/share/fonts/
fc-cache -rv
- name: init oss config
uses: yizhoumo/setup-ossutil@v1
with:
ossutil-version: '1.7.3'
endpoint: ${{secrets.OSS_ENDPOINT}}
access-key-id: ${{secrets.OSS_ID}}
access-key-secret: ${{secrets.OSS_SECRET}}
sts-token: ""
- name: Build trpl book
run: |
# Build trpl book
mkdir -pv trpl-archive/{en,zh}
cd trpl-en && \
mdbook build && \
cp -ar book/* ../trpl-archive/en/
cd ../trpl-zh && \
mdbook build && \
ls -al && \
cp -ar book/html/* ../trpl-archive/zh/
cp "book/typst-pdf/Rust 程序设计语言 简体中文版.pdf" ../trpl-archive/zh/
# Upload to oss
ls -alhtr && \
cd .. && \
ossutil sync trpl-archive/ oss://${{ secrets.OSS_BUCKET }}/trpl/ -f --delete
- name: Sending Build Status
if: always()
env:
DINGTALK_ACCESS_TOKEN: ${{ secrets.DINGTALK_ACCESS_TOKEN }}
DINGTALK_SECRET: ${{ secrets.DINGTALK_SECRET }}
JOB_STATE: ${{ job.status }}
RUNNER_OS: ${{ runner.os }}
GITHUB_REF: ${{ github.ref }}
GITHUB_RUN_ID: ${{ github.run_id }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_WORKFLOW: ${{ env.GITHUB_WORKFLOW }}
run: python3 notify.py