-
Notifications
You must be signed in to change notification settings - Fork 233
71 lines (60 loc) · 1.96 KB
/
generate-pdf.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
name: Generate Tutorial PDF
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Setup Environment
run: |
sudo apt update
sudo apt install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-xetex fonts-freefont-otf texlive-fonts-recommended texlive-lang-chinese tex-gyre
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt-get install -y nodejs
npm install -g @mermaid-js/mermaid-cli
sudo apt-get install -y python3-sphinx
sudo apt-get install -y python3-pip
- name: Apply Patch
run: |
git apply --reject scripts/latexpdf.patch
- name: Install Python Dependencies
run: |
pip install -r requirements.txt
- name: Generate PDF
run: |
make latexpdf
- name: Upload PDF to Artifacts
uses: actions/upload-artifact@v2
with:
name: tutorial-pdf
path: build/latex/rcore-tutorial-book-v3.pdf
- name: Get Current Date and Time
id: datetime
run: echo "::set-output name=datetime::$(date +'%Y%m%d-%H%M')"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.datetime.outputs.datetime }}
release_name: Release ${{ steps.datetime.outputs.datetime }}
draft: false
prerelease: false
- name: Upload PDF to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/latex/rcore-tutorial-book-v3.pdf
asset_name: rcore-tutorial-book-v3.pdf
asset_content_type: application/pdf