99 lines
3.6 KiB
YAML
99 lines
3.6 KiB
YAML
name: "Deploy Docs"
|
|
on:
|
|
push:
|
|
branches: ["master", "release/stable"]
|
|
pull_request:
|
|
branches: ["master", "release/*"]
|
|
paths:
|
|
- ".github/workflows/docs-deploy.yml"
|
|
# TODO: this workflow is just for debugging. extend the paths that should trigger it
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
# https://github.com/marketplace/actions/deploy-to-github-pages
|
|
build-docs-deploy:
|
|
if: github.repository_owner == 'Lightning-AI'
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- name: Checkout 🛎️
|
|
uses: actions/checkout@v3
|
|
# If you're using actions/checkout@v3 you must set persist-credentials to false in most cases for the deployment to work correctly.
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-python@v4
|
|
with:
|
|
python-version: 3.8
|
|
|
|
- uses: aws-actions/configure-aws-credentials@v1
|
|
with:
|
|
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY_ID }}
|
|
aws-region: us-east-1
|
|
- run: aws s3 sync s3://sphinx-packages/ pypi/
|
|
|
|
# Note: This uses an internal pip API and may not always work
|
|
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
|
|
- name: Cache pip
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-deploy-docs-pip-${{ hashFiles('requirements/app/*.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-deploy-docs-pip-
|
|
|
|
- name: Install package & dependencies
|
|
env:
|
|
FREEZE_REQUIREMENTS: 1
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y cmake pandoc
|
|
sudo apt-get install -y texlive-latex-extra dvipng texlive-pictures
|
|
pip --version
|
|
pip install -e . --quiet -r requirements/app/docs.txt \
|
|
-f https://download.pytorch.org/whl/cpu/torch_stable.html -f pypi
|
|
pip list
|
|
|
|
- name: Make Documentation
|
|
working-directory: ./docs/source-app
|
|
run: |
|
|
# First run the same pipeline as Read-The-Docs
|
|
make clean
|
|
make html --jobs 2
|
|
|
|
- name: Deploy 🚀
|
|
uses: JamesIves/github-pages-deploy-action@v4.4.1
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
branch: gh-pages # The branch the action should deploy to.
|
|
folder: docs/build/html # The folder the action should deploy.
|
|
clean: true # Automatically remove deleted files from deploy branch
|
|
target-folder: docs # If you'd like to push the contents of the deployment folder into a specific directory
|
|
single-commit: true # you'd prefer to have a single commit on the deployment branch instead of full history
|
|
if: success()
|
|
|
|
- id: 'auth'
|
|
name: 'Authenticate to Google Cloud'
|
|
uses: google-github-actions/auth@v1
|
|
with:
|
|
credentials_json: ${{ secrets.GCS_SA_KEY }}
|
|
|
|
- name: Setup gcloud
|
|
uses: google-github-actions/setup-gcloud@v1
|
|
with:
|
|
project_id: ${{ secrets.GCS_PROJECT }}
|
|
|
|
# Uploading docs to GCS, so they can be served on lightning.ai
|
|
- name: Upload docs/stable to GCS 🪣
|
|
if: ${{ success() && startsWith(github.ref, 'refs/heads/release/') }}
|
|
run: |-
|
|
gsutil -m rsync -d -R docs/build/html/ gs://lightning-docs-stable
|
|
|
|
# Uploading docs to GCS, so they can be served on lightning.ai
|
|
- name: Upload docs/latest to GCS 🪣
|
|
if: ${{ success() && github.ref == 'refs/heads/master' }}
|
|
run: |-
|
|
gsutil -m rsync -d -R docs/build/html/ gs://lightning-docs-latest
|