Skip to content

Commit

Permalink
ci: generate schemas and documentation
Browse files Browse the repository at this point in the history
 * generate JSON schemas and documentation
 * upload documentation artifacts
 * create index.html for GitHub pages
 * publish documentation as GitHub pages (only on main branch)

Signed-off-by: Petr Štetiar <ynezz@true.cz>
  • Loading branch information
ynezz committed Apr 9, 2021
1 parent d7d1e04 commit 7b5f381
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,37 @@ jobs:
make -j$(($(nproc)+1)) -C $(pwd)/build all
sudo make -C $(pwd)/build install
- name: Install Python dependencies for YAML schemas
run: |
sudo apt-get install python3-setuptools
python3 -m pip install -U pip
python3 -m pip install -r requirements.txt
- name: Generate JSON schemas and documentation
run: ./generate.sh

- name: Run ucode based tests
run: ./run_tests.sh

- name: Generate abbreviated commit hash
run: echo "abbrev_commit=$(echo ${{ github.sha }} | cut -b1-8)" >> $GITHUB_ENV

- name: Upload documentation artifacts
uses: actions/upload-artifact@v2
with:
if-no-files-found: error
name: ucentral-schema-docs-${{ env.abbrev_commit }}
path: docs

- name: Create index.html for GitHub pages
run: |
cp docs/ucentral-schema.html docs/index.html
sed -i "s/Schema Docs/OpenWrt uCentral Schema Docs (${{ env.abbrev_commit }})/" docs/index.html
sed -i "s;Generated using;Generated from <a href=\"https://github.com/${{ github.repository }}/commit/${{ env.abbrev_commit}}\">${{ github.repository }}@${{ env.abbrev_commit }}</a> using;" docs/index.html
- name: Publish documentation
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs

0 comments on commit 7b5f381

Please sign in to comment.