Merge pull request #25 from philo9100/philo9100 #521
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build docs | |
on: | |
push: | |
branches: | |
- master | |
- release/* | |
env: | |
EM_VERSION: 2.0.4 | |
EM_CACHE_FOLDER: 'emsdk-cache' | |
jobs: | |
build-and-deploy: | |
#if: github.repository == 'lvgl/lvgl' | |
runs-on: ubuntu-22.04 | |
concurrency: docs-build-and-deploy | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Cache Python packages | |
uses: actions/cache@v4 | |
with: | |
# Cache the Python package environment, excluding pip and setuptools installed by setup-python | |
path: | | |
~/.cache/pip | |
${{ env.pythonLocation }}/bin/* | |
${{ env.pythonLocation }}/include | |
${{ env.pythonLocation }}/lib/python*/site-packages/* | |
!${{ env.pythonLocation }}/bin/pip* | |
!${{ env.pythonLocation }}/lib/python*/site-packages/pip* | |
!${{ env.pythonLocation }}/lib/python*/site-packages/setuptools* | |
key: ${{ env.pythonLocation }}-${{ hashFiles('docs/requirements.txt') }} | |
- name: Install Doxygen and Latex dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install doxygen texlive-xetex texlive-binaries texlive-lang-english texlive-lang-chinese latexmk fonts-freefont-otf | |
- name: Install requirements | |
run: | | |
pip install -r docs/requirements.txt | |
- name: Setup Emscripten cache | |
id: cache-system-libraries | |
uses: actions/cache@v4 | |
with: | |
path: ${{env.EM_CACHE_FOLDER}} | |
key: ${{env.EM_VERSION}}-${{ runner.os }} | |
- uses: mymindstorm/setup-emsdk@v14 | |
with: | |
version: ${{env.EM_VERSION}} | |
actions-cache-folder: ${{env.EM_CACHE_FOLDER}} | |
- name: ccache | |
uses: hendrikmuhs/ccache-action@v1 | |
- name: Build examples (with cache) | |
run: | | |
chmod -R 777 scripts | |
scripts/build_html_examples.sh | |
- name: Build docs | |
run: | | |
chmod 777 docs/build.py | |
docs/build.py skip_latex | |
- name: Remove .doctrees | |
run: ls -l && rm -rf out_html/.doctrees | |
- name: Retrieve version | |
run: | | |
ls -l | |
ls -l emsdk-cache | |
ls -l docs | |
echo "::set-output name=VERSION_NAME::$(scripts/find_version.sh)" | |
id: version | |
# Publish built docs to gh-pages branch. | |
# =============================== | |
- name: Commit documentation changes | |
run: | | |
git clone https://${{secrets.CODING_USERNAME}}:${{secrets.CODING_PASSWD}}@e.coding.net/weidongshan/sphinx_docs/100ask_lvgl_docs.git --depth=1 --branch master --single-branch master | |
mkdir -p master/master | |
mkdir -p master/${{ steps.version.outputs.VERSION_NAME }} | |
rm -rf master/master/* | |
rm -rf master/${{ steps.version.outputs.VERSION_NAME }}/* | |
cp -r out_html/* master/master | |
cp -r out_html/* master/${{ steps.version.outputs.VERSION_NAME }} | |
ls | |
cd master | |
touch master/.nojekyll | |
git config --local user.email "[email protected]" | |
git config --local user.name "www.100ask.org" | |
git add . | |
git commit -m "Update documentation" -a || true | |
git push origin master | |
#- name: executing remote ssh command using password | |
# uses: appleboy/ssh-action@master | |
# with: | |
# host: ${{ secrets.HOST }} | |
# username: root | |
# key: ${{ secrets.SSH_ID_RSA }} | |
# port: 22 | |
# script: | | |
# ls -al | |
# cd /home/100ask_lvgl_docs && git pull | |
# =============================== | |
#- name: Deploy | |
# uses: JamesIves/[email protected] | |
# with: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# ACCESS_TOKEN: ${{ secrets.LVGL_BOT_TOKEN }} | |
# REPOSITORY_NAME: lvgl/docs_compiled | |
# BRANCH: gh-pages # The branch the action should deploy to. | |
# FOLDER: out_html # The folder the action should deploy. | |
# TARGET_FOLDER: ${{ steps.version.outputs.VERSION_NAME }} | |
# PRESERVE: true | |
# SINGLE_COMMIT: true |