1name: Build docs
2on:
3  push:
4    branches:
5    - master
6    - 'release/*'
7env:
8  EM_VERSION: 2.0.4
9  EM_CACHE_FOLDER: 'emsdk-cache'
10jobs:
11  build-and-deploy:
12    if: github.repository == 'lvgl/lvgl'
13    runs-on: ubuntu-latest
14    concurrency: docs-build-and-deploy
15    steps:
16      - name: Checkout
17        uses: actions/checkout@v2
18        with:
19          persist-credentials: false
20          fetch-depth: 0
21      - name: Setup Python
22        uses: actions/setup-python@v1
23        with:
24          python-version: 3.7
25      - name: Cache Python packages
26        uses: actions/cache@v2
27        with:
28          # Cache the Python package environment, excluding pip and setuptools installed by setup-python
29          path: |
30            ~/.cache/pip
31            ${{ env.pythonLocation }}/bin/*
32            ${{ env.pythonLocation }}/include
33            ${{ env.pythonLocation }}/lib/python*/site-packages/*
34            !${{ env.pythonLocation }}/bin/pip*
35            !${{ env.pythonLocation }}/lib/python*/site-packages/pip*
36            !${{ env.pythonLocation }}/lib/python*/site-packages/setuptools*
37          key: ${{ env.pythonLocation }}-${{ hashFiles('docs/requirements.txt') }}
38      - name: Install Doxygen and Latex dependencies
39        run: |
40          sudo apt-get update
41          sudo apt-get install doxygen texlive-xetex texlive-binaries texlive-lang-english latexmk fonts-freefont-otf
42      - name: Install requirements
43        run: |
44          pip install -r docs/requirements.txt
45      - name: Setup Emscripten cache
46        id: cache-system-libraries
47        uses: actions/cache@v2
48        with:
49          path: ${{env.EM_CACHE_FOLDER}}
50          key: ${{env.EM_VERSION}}-${{ runner.os }}
51      - uses: mymindstorm/setup-emsdk@v9
52        with:
53          version: ${{env.EM_VERSION}}
54          actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
55      - name: ccache
56        uses: hendrikmuhs/ccache-action@v1
57      - name: Build examples (with cache)
58        run: scripts/build_html_examples.sh
59      - name: Build docs
60        run: docs/build.py
61      - name: Remove .doctrees
62        run: rm -rf out_html/.doctrees
63      - name: Retrieve version
64        run: |
65          echo "::set-output name=VERSION_NAME::$(scripts/find_version.sh)"
66        id: version
67      - name: Deploy to subfolder
68        uses: JamesIves/github-pages-deploy-action@3.7.1
69        with:
70          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71          ACCESS_TOKEN: ${{ secrets.LVGL_BOT_TOKEN }}
72          REPOSITORY_NAME: lvgl/docs
73          BRANCH: gh-pages # The branch the action should deploy to.
74          FOLDER: out_html  # The folder the action should deploy.
75          TARGET_FOLDER: ${{ steps.version.outputs.VERSION_NAME }}
76          GIT_CONFIG_NAME: lvgl-bot
77          GIT_CONFIG_EMAIL: lvgl-bot@users.noreply.github.com
78          PRESERVE: true
79          SINGLE_COMMIT: true
80      - name: Deploy to master
81        if: github.ref == 'refs/heads/master'
82        uses: JamesIves/github-pages-deploy-action@3.7.1
83        with:
84          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85          ACCESS_TOKEN: ${{ secrets.LVGL_BOT_TOKEN }}
86          REPOSITORY_NAME: lvgl/docs
87          BRANCH: gh-pages # The branch the action should deploy to.
88          FOLDER: out_html  # The folder the action should deploy.
89          TARGET_FOLDER: master
90          GIT_CONFIG_NAME: lvgl-bot
91          GIT_CONFIG_EMAIL: lvgl-bot@users.noreply.github.com
92          PRESERVE: true
93          SINGLE_COMMIT: true
94