forked from OSGeo/gdal
-
Notifications
You must be signed in to change notification settings - Fork 2
137 lines (129 loc) · 4.39 KB
/
doc_build.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Docs
on:
push:
branches-ignore:
- 'backport**'
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
docs:
permissions:
contents: write # for Git to git push
name: Docs
runs-on: ubuntu-latest
strategy:
fail-fast: true
container: ghcr.io/osgeo/proj-docs
steps:
- uses: actions/checkout@v3
- name: Setup environment
shell: bash -l {0}
run: |
apt update
apt install -y libproj-dev swig
python3 -m pip install -r doc/requirements.txt
python3 -m pip install numpy
pushd .
mkdir build
cd build
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DBUILD_APPS=OFF \
-DGDAL_BUILD_OPTIONAL_DRIVERS=OFF \
-DOGR_BUILD_OPTIONAL_DRIVERS=OFF
cmake --build . -j$(nproc)
cmake --install .
ldconfig
popd
- name: Pin sphinx version
# Avoid https://github.com/sphinx-doc/sphinx/issues/11163
shell: bash -l {0}
run: |
python3 -m pip install --user "sphinx==6.0.1"
- name: Print versions
shell: bash -l {0}
run: |
python3 --version
sphinx-build --version
python3 -m pip list --not-required --format=columns
- name: Lint .rst files
shell: bash -l {0}
run: |
if find . -name '*.rst' | xargs grep -P '\t'; then echo 'Tabs are bad, please use four spaces in .rst files.'; false; fi
if find . -name '*.rst' | xargs grep "\.\.versionadded"; then echo 'Wrong annotation. Should be .. versionadded'; false; fi
if find . -name '*.rst' | xargs grep "\.\.note"; then echo 'Wrong annotation. Should be .. note'; false; fi
if find . -name '*.rst' | xargs grep "\.\.warning"; then echo 'Wrong annotation. Should be .. warning'; false; fi
if find . -name '*.rst' | xargs grep "\.\.codeblock"; then echo 'Wrong annotation. Should be .. codeblock'; false; fi
working-directory: ./doc
- name: Doxygen
shell: bash -l {0}
run: |
mkdir -p doc/build
doxygen Doxyfile
- name: HTML
shell: bash -l {0}
run: |
make html O="-D enable_redirects=1"
working-directory: ./doc
- name: PDF
shell: bash -l {0}
run: |
make latexpdf
working-directory: ./doc
#- name: Spelling
# shell: bash -l {0}
# run: |
# make spelling
# working-directory: ./doc
- uses: actions/upload-artifact@v3
with:
name: PDF
path: doc/build/latex/gdal.pdf
- uses: actions/upload-artifact@v3
with:
name: HTML
path: doc/build/html/*
#- uses: actions/upload-artifact@v3
# with:
# name: Misspelled
# path: doc/build/spelling/output.txt
- name: Deploy ssh key
if: ${{ github.ref_name == 'master' && github.repository == 'OSGeo/gdal' }}
shell: bash -l {0}
run: |
mkdir /root/.ssh && echo "${{ secrets.SSH_KEY_DOCS }}" > /root/.ssh/id_rsa
chmod 700 /root/.ssh && chmod 600 /root/.ssh/id_rsa
ssh-keyscan -t rsa github.com >> /root/.ssh/known_hosts
eval `ssh-agent -s`
ssh-add /root/.ssh/id_rsa
- name: Deploy to gdal.org
if: ${{ github.ref_name == 'master' && github.repository == 'OSGeo/gdal' }}
shell: bash -l {0}
run: |
set -x
set -e
cd /__w/gdal
mv gdal/doc/build/html gdal-docs
rm gdal-docs/gdal.pdf
cp gdal/doc/build/latex/gdal.pdf gdal-docs
cp gdal/data/gdalicon.png gdal-docs # For GDAL autotest...
cp -r gdal/resources gdal-docs # Do not change this without changing swig/python/gdal-utils/osgeo_utils/gdal2tiles.py
cd gdal-docs
wget http://download.osgeo.org/gdal/for_doc/javadoc.zip -O /tmp/javadoc.zip
unzip -q /tmp/javadoc.zip
git init
git config user.email "proj4bot@proj4.bot"
git config user.name "GDAL Bot"
git remote add origin git@github.com:OSGeo/gdal-docs.git
git remote -v
echo "gdal.org" > CNAME
touch .nojekyll
git add -A
git commit -m "Update with OSGeo/gdal commit $GITHUB_SHA"
git push -f origin master