diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 5c75db64..3932ee8e 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -40,3 +40,48 @@ jobs: - name: Check source code licenses run: | docker run --platform=linux/amd64 -v ${PWD}:/src ghcr.io/google/addlicense -v -check -l BSD-2-Clause -c "ChipFlow" -s=only -ignore **/__init__.py **/*.py + + build-docs: + needs: test + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up PDM + uses: pdm-project/setup-pdm@v4 + with: + python-version: 3.9 + - name: Install deps + run: pdm install + - name: Build docs + run: pdm run document + - name: Upload docs artifact + uses: actions/upload-artifact@v4 + with: + name: docs + path: docs/_build + + publish-docs: + needs: build-docs + if: ${{ github.repository == 'chipflow/chipflow-lib' }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Download docs artifact + uses: actions/download-artifact@v4 + with: + name: docs + path: docs/ + - name: Publish "latest" docs + if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }} + uses: JamesIves/github-pages-deploy-action@releases/v4 + with: + repository-name: chipflow/chipflow.github.io + ssh-key: ${{ secrets.PAGES_DEPLOY_KEY }} + branch: main + folder: docs/ + target-folder: chipflow-lib/latest/ + \ No newline at end of file