-
Notifications
You must be signed in to change notification settings - Fork 1
94 lines (76 loc) · 2.79 KB
/
build-docs.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
name: build-docs
on:
workflow_run:
workflows: ['call-submodule-corrector']
branches: ['master']
types:
- completed
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-docs:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-22.04
container:
image: ghcr.io/xu-cheng/texlive-full:latest
steps:
- name: Checkout current repository
uses: actions/checkout@v3
- name: Checkout ts-latex-lib
uses: actions/checkout@v3
with:
repository: 'tropicsquare/ts-latex-lib'
ref: 'refs/heads/master'
path: 'ts-latex-lib'
# TODO: replace personal token (go public)
token: ${{ secrets.PAT_SECRET }}
- name: Compile docs
id: compile-docs
run: |
cp -r ts-latex-lib /ts-latex-lib
cp -r doc /doc
export TEXINPUTS=.:/ts-latex-lib//:
chmod +x /ts-latex-lib/scripts/ts_latex_build.py
export PATH=$PATH:/ts-latex-lib/scripts/
cd /doc/programmer_guide
ts_latex_build.py spect_programmer_guide.tex
cd /doc/ISAv0.1
ts_latex_build.py isav0.1.tex
cd /doc/ISAv0.2
ts_latex_build.py isav0.2.tex
- name: Upload PDF artifacts
uses: actions/upload-artifact@v3
with:
name: SPECT_documentation
path: |
/doc/programmer_guide/build/pdf/spect_programmer_guide.pdf
/doc/ISAv0.1/build/pdf/isav0.1.pdf
/doc/ISAv0.2/build/pdf/isav0.2.pdf
retention-days: 2
push-docs:
runs-on: ubuntu-22.04
needs: build-docs
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download documentation artifact
uses: actions/download-artifact@v3
with:
name: SPECT_documentation
path: ${{ github.workspace }}/artifacts
- name: Commit and push
run: |
mkdir -p doc/programmer_guide/pdf
mv ${{ github.workspace }}/artifacts/programmer_guide/build/pdf/spect_programmer_guide.pdf doc/programmer_guide/pdf/
mkdir -p doc/ISAv0.1/pdf
mv ${{ github.workspace }}/artifacts/ISAv0.1/build/pdf/isav0.1.pdf doc/ISAv0.1/pdf/
mkdir -p doc/ISAv0.2/pdf
mv ${{ github.workspace }}/artifacts/ISAv0.2/build/pdf/isav0.2.pdf doc/ISAv0.2/pdf/
git config --global user.name "[bot]upload-docs"
git config --global user.email "[bot][email protected]"
git status
git add doc/programmer_guide/pdf/spect_programmer_guide.pdf
git add doc/ISAv0.1/pdf/isav0.1.pdf
git add doc/ISAv0.2/pdf/isav0.2.pdf
git commit -m "Autogenerate PDFs"
git push origin master