generated from pds-data-dictionaries/ldd-template
-
Notifications
You must be signed in to change notification settings - Fork 1
108 lines (94 loc) · 2.76 KB
/
build-docs.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
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 and Deploy Docs
on:
push:
branches:
- 'main'
paths:
- 'docs/**'
- 'src/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Single deploy job since we're just deploying
deploy:
name: 'Build and Deploy Sphinx Docs'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
if: github.actor != 'pdsen-ci'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.ADMIN_GITHUB_TOKEN || github.token }}
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install dependencies
run: |
# Install Sphinx
pip install -r docs/requirements.txt
- name: Make Sphinx
id: make
run: |
cd docs
# Make the HTML docs and copy to main
make github
cd ..
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
pdfgen: # job 1
name: 'Build PDF'
runs-on: ubuntu-latest
if: github.actor != 'pdsen-ci'
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.ADMIN_GITHUB_TOKEN || github.token }}
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install dependencies
run: |
# Install Sphinx
pip install -r docs/requirements.txt
# Install dependencies for PDF generation
sudo apt install texlive-latex-recommended texlive-fonts-recommended texlive-latex-extra latexmk
- name: Generate PDF
id: make
run: |
cd docs
make latexpdf
cp build/latex/*.pdf .
- name: Push PDF to Github
run: |
git config --local user.email "pdsen-ci@jpl.nasa.gov"
git config --local user.name "PDSEN CI Bot"
git add -A ./*.pdf
git commit --allow-empty -m "Auto-gen PDF by PDSEN CI Bot"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
branch: ${{ github.ref }}
force: true