Doc #343
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: Documentation | |
on: | |
workflow_dispatch: | |
release: | |
types: [published] | |
workflow_call: | |
jobs: | |
build_docs: | |
if: ${{ !((github.event_name == 'release' && github.event.action == 'published') || github.event_name == 'workflow_dispatch') }} | |
runs-on: ubuntu-22.04 | |
env: | |
PUPPETEER_CACHE_DIR: ${{ github.workspace }}/node_modules/.chromium | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Cache dev-py environment | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: cache_dev_py_ubuntu22_${{ hashFiles('pdm.lock') }} | |
- name: Cache dev-js environment | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: cache_dev_js_ubuntu22_${{ hashFiles('package-lock.json') }} | |
- name: Cache coverage | |
uses: actions/cache@v3 | |
with: | |
path: .coverage/html | |
key: cache_coverage_${{ github.run_id }} | |
- name: Install package | |
run: | | |
source .venv/bin/activate | |
pdm run pkg_install | |
- name: Get vizzu-lib tag | |
id: vizzu_tag | |
run: | | |
source .venv/bin/activate | |
vizzu_tag=$(./.venv/bin/python ./tools/ci/get_tag.py) | |
echo "vizzu_tag=${vizzu_tag}" >> $GITHUB_OUTPUT | |
- name: Checkout vizzu-lib | |
uses: actions/checkout@v3 | |
with: | |
repository: vizzuhq/vizzu-lib | |
fetch-depth: 1 | |
ref: ${{ steps.vizzu_tag.outputs.vizzu_tag }} | |
path: vizzu-lib | |
- name: Build documentation | |
run: | | |
source .venv/bin/activate | |
pdm run docs_build | |
publish_docs: | |
if: ${{ ((github.event_name == 'release' && github.event.action == 'published') || github.event_name == 'workflow_dispatch') }} | |
runs-on: ubuntu-22.04 | |
env: | |
PUPPETEER_CACHE_DIR: ${{ github.workspace }}/node_modules/.chromium | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Cache dev-py environment | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: cache_dev_py_ubuntu22_${{ hashFiles('pdm.lock') }} | |
- name: Cache dev-js environment | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: cache_dev_js_ubuntu22_${{ hashFiles('package-lock.json') }} | |
- name: Get workflow ID | |
id: workflow_id | |
run: | | |
workflow_data=$(curl -s -X GET \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
"https://api.github.com/repos/$GITHUB_REPOSITORY/actions/workflows") | |
workflow_id=$(echo $workflow_data | jq -r '.workflows[] | select(.name == "CI-CD") | .id') | |
echo "workflow_id=${workflow_id}" >> $GITHUB_OUTPUT | |
- name: Get run ID | |
id: run_id | |
run: | | |
run_data=$(curl -s -X GET \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
"https://api.github.com/repos/$GITHUB_REPOSITORY/actions/workflows/${{ steps.workflow_id.outputs.workflow_id }}/runs?branch=main") | |
run_id=$(echo $run_data | jq -r '.workflow_runs[0].id') | |
echo "run_id=${run_id}" >> $GITHUB_OUTPUT | |
- name: Cache coverage | |
uses: actions/cache@v3 | |
with: | |
path: .coverage/html | |
key: cache_coverage_${{ steps.run_id.outputs.run_id }} | |
- name: Install package | |
run: | | |
source .venv/bin/activate | |
pdm run pkg_install | |
- name: Get vizzu-lib tag | |
id: vizzu_tag | |
run: | | |
source .venv/bin/activate | |
vizzu_tag=$(./.venv/bin/python ./tools/ci/get_tag.py) | |
echo "vizzu_tag=${vizzu_tag}" >> $GITHUB_OUTPUT | |
- name: Checkout vizzu-lib | |
uses: actions/checkout@v3 | |
with: | |
repository: vizzuhq/vizzu-lib | |
fetch-depth: 1 | |
ref: ${{ steps.vizzu_tag.outputs.vizzu_tag }} | |
path: vizzu-lib | |
- name: Configure Git | |
run: | | |
git config --global user.name "${{ env.GIT_USER_NAME }}" | |
git config --global user.email "${{ env.GIT_USER_EMAIL }}" | |
env: | |
GIT_USER_NAME: David Vegh | |
GIT_USER_EMAIL: [email protected] | |
- name: Deploy documentation | |
run: | | |
source .venv/bin/activate | |
git fetch origin gh-pages || echo "gh-pages does not exist" | |
pdm run docs_deploy | |
git push origin gh-pages |