Skip to content

Doc

Doc #351

Workflow file for this run

name: Doc
on:
workflow_dispatch:
release:
types: [published]
workflow_call:
jobs:
build:
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 venv
uses: actions/cache@v3
with:
path: .venv
key: venv_ubuntu22_${{ hashFiles('pdm.lock') }}
- name: Cache node modules
uses: actions/cache@v3
with:
path: node_modules
key: node_modules_ubuntu22_${{ hashFiles('package-lock.json') }}
- name: Cache coverage
uses: actions/cache@v3
with:
path: .coverage/html
key: coverage_${{ github.run_id }}
- name: Deploy package
run: |
source .venv/bin/activate
pdm run deploy
- 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 build-docs
deploy:
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 venv
uses: actions/cache@v3
with:
path: .venv
key: venv_ubuntu22_${{ hashFiles('pdm.lock') }}
- name: Cache node modules
uses: actions/cache@v3
with:
path: node_modules
key: node_modules_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.VIZZUHQ_GITHUB_API }}" \
"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.VIZZUHQ_GITHUB_API }}" \
"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: coverage_${{ steps.run_id.outputs.run_id }}
- name: Deploy package
run: |
source .venv/bin/activate
pdm run deploy
- 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 "${{ secrets.VIZZUHQ_GITHUB_USER }}"
git config --global user.email "${{ secrets.VIZZUHQ_GITHUB_EMAIL }}"
- name: Deploy documentation
run: |
source .venv/bin/activate
git fetch origin gh-pages || echo "gh-pages does not exist"
pdm run deploy-docs
git push origin gh-pages