-
Notifications
You must be signed in to change notification settings - Fork 29
70 lines (68 loc) · 2.71 KB
/
cheatsheet.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
name: Create cheatsheet
on:
push:
branches:
- "**"
tags:
- "v*.*.*"
jobs:
cheatsheet:
runs-on: ubuntu-latest
if: "'refs/heads/master' != github.ref && 'refs/heads/develop' != github.ref && !startsWith(github.ref, 'refs/tags/')"
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Install dependencies
uses: ./.github/actions/install-linux
- name: Install xetex
run: |
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu jammy main restricted multiverse universe"
sudo apt-get update -y
sudo apt-get install -y -t jammy texlive-xetex
- name: Build cheatsheet
run: |
sphinx-build -b latex -c docs/cheatsheet/ docs docs/latex/ -W
cd docs/latex/
xelatex cheatsheet
cat <(md5sum cheatsheet.tex) <(md5sum sdsc_cheatsheet.cls) > ../cheatsheet_hash_new
cd ../..
env:
CHEATSHEET_TARGET: rp
- name: Build cheatsheet json
run: |
sphinx-build -b json -c docs/cheatsheet/ docs docs/json/ -W
cd docs/json/
python -c 'import json; print(json.dumps(json.loads(json.load(open("cheatsheet.fjson", "r"))["body"]), indent=2, sort_keys=True))' > cheatsheet.json
cat <(md5sum cheatsheet.json) > ../cheatsheet_json_hash_new
cd ../..
- name: Publish cheatsheet if changed
id: publish-pdf
if: ${{ hashFiles('docs/cheatsheet_hash') != hashFiles('docs/cheatsheet_hash_new') }}
run: |
cat docs/cheatsheet_hash
cat docs/cheatsheet_hash_new
cd docs
rm cheatsheet_hash
mv cheatsheet_hash_new cheatsheet_hash
cp latex/cheatsheet.pdf _static/cheatsheet/
git add cheatsheet_hash _static/cheatsheet/cheatsheet.pdf
git commit -m "chore: Update cheatsheet pdf"
- name: Publish UI cheatsheet if changed
id: publish-json
if: ${{ hashFiles('docs/cheatsheet_json_hash') != hashFiles('docs/cheatsheet_json_hash_new') }}
run: |
cat docs/cheatsheet_json_hash
cat docs/cheatsheet_json_hash_new
cd docs
rm cheatsheet_json_hash
mv cheatsheet_json_hash_new cheatsheet_json_hash
cp json/cheatsheet.json _static/cheatsheet/
git add cheatsheet_json_hash _static/cheatsheet/cheatsheet.json
git commit -m "chore: Update cheatsheet json"
- name: Push changes
uses: ad-m/github-push-action@master
if: (steps.publish-pdf.outcome != 'Skipped' || steps.publish-json.outcome != 'Skipped') && success()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}