Revision 587e0e5356a245645f37a6185306f8126fa0d222 authored by Jean Kossaifi on 08 November 2021, 11:54:34 UTC, committed by Jean Kossaifi on 08 November 2021, 11:54:34 UTC
1 parent 9aaaac1
Raw File
build_doc.yml
name: Build documentation

on:
  push:
    branches:
      - main

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Install Python
        uses: actions/setup-python@v2
        with:
          python-version: 3.8
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          python -m pip install -r requirements.txt
          python -m pip install -r doc/requirements_doc.txt
      - name: Install package
        run: |
          python -m pip install -e .
      - name: Make doc
        run: |
          cd doc
          python minify.py
          make html
          cd ..
      - name: Push doc to website
        if: success()
        run: |
          # Add deploy key and clone through ssh
          eval "$(ssh-agent -s)"
          mkdir ~/.ssh
          echo "${{ secrets.DEPLOY_DOC_KEY }}" > ~/.ssh/id_rsa
          chmod 600 ~/.ssh/id_rsa
          ssh-keyscan -t rsa github.com
          echo 'Documentation was successfully built, updating the website.'
          # See https://github.community/t/github-actions-bot-email-address/17204/5
          git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
          git config --global user.name "github-actions"
          git clone "git@github.com:tensorly/tensorly.github.io.git" doc_folder
          echo "-- Updating the content"
          cd doc_folder
          git rm -r dev/*
          mkdir -p dev
          echo "Copying to folder"
          cp -r ../doc/_build/html/* dev/
          echo "Pushing to git"
          git add dev
          git commit -m "Github action: auto-update."
          git push --force origin main
back to top