Skip to content

Commit

Permalink
Merge pull request #400 from kbolashev/docs/ci
Browse files Browse the repository at this point in the history
Add a GitHub Action to build and upload docs to a GCS Bucket
  • Loading branch information
kbolashev authored Dec 24, 2023
2 parents 151de60 + 890016b commit fd76257
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/docs-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Publish Docs

on:
workflow_dispatch:
release:
types: [published]

jobs:
deploy:

runs-on: ubuntu-latest

defaults:
run:
working-directory: "./docs"

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install client and dependencies
working-directory: "./"
run: |
python -m pip install --upgrade pip setuptools
pip install .
- name: Install docs dependencies
run: |
pip install -r requirements-docs.txt
- name: Build documentation
run: make html

# - name: Upload docs as artifact
# uses: actions/upload-artifact@v3
# with:
# name: docs
# path: docs/build

- name: Authenticate with Google
uses: "google-github-actions/auth@v2"
with:
project_id: ${{ secrets.GCS_PROJECT }}
credentials_json: ${{ secrets.GCS_SERVICE_ACCOUNT_ACCESS_KEY }}

- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'

- name: Upload to Google Cloud Storage
env:
UPLOAD_PATH: ${{ format('gs://{0}/docs/client', secrets.DOCS_BUCKET) }}
run: gsutil -m rsync -d -r build/html $UPLOAD_PATH

- name: Invalidate CDN Cache
env:
LOAD_BALANCER: ${{ secrets.LOAD_BALANCER_NAME }}
run: gcloud compute url-maps invalidate-cdn-cache $LOAD_BALANCER --path "/docs/client/*"

5 changes: 5 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

import os
import sys
project_root = os.path.join(__file__, "../../..")
sys.path.insert(0, os.path.abspath(project_root))

project = "DagsHub Client"
copyright = "2023, DagsHub"
author = "DagsHub"
Expand Down

0 comments on commit fd76257

Please sign in to comment.