-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Migrate docs build to GitHub Actions #5541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
LiamConnors
wants to merge
28
commits into
main
Choose a base branch
from
migrate-to-gh-actions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+161
−111
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
231bc62
Create tests.yml
LiamConnors 6090379
test formatting
LiamConnors d2ac9c1
Update MIGRATION_GUIDE.md
LiamConnors 3182c45
add core tests
LiamConnors 78479b2
Revert "test formatting"
LiamConnors bbd4f52
test gh action
LiamConnors 009beb9
Revert "test gh action"
LiamConnors e1db3fd
add new build doc workflow
LiamConnors 67f3fe3
Update build-doc.yml
LiamConnors aae7584
remove tests workflow
LiamConnors 5b0ef50
Merge branch 'main' into migrate-to-gh-actions
LiamConnors 6a79b02
Update build-doc.yml
LiamConnors a6620b5
Update build-doc.yml
LiamConnors ad464cb
only save html files
LiamConnors fa90dc7
add api reference build to artifacts
LiamConnors bb8798a
Update requirements.txt
LiamConnors 4f27e9e
Update config.yml
LiamConnors 58b46ab
Update config.yml
LiamConnors 1f0df2e
store all artifacts for testing
LiamConnors 1d05f5d
remove build doc
LiamConnors dff6abc
Update build-doc.yml
LiamConnors 4e98be7
remove notebook and api docs artifacts
LiamConnors 3ae6074
change step order
LiamConnors 52a0d06
test build
LiamConnors 783a953
Update build-doc.yml
LiamConnors 400aed3
Apply suggestion from @LiamConnors
LiamConnors 700b472
Apply suggestion from @LiamConnors
LiamConnors 7f45be9
Merge branch 'main' into migrate-to-gh-actions
LiamConnors File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,160 @@ | ||
| name: Build Documentation | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - doc-prod | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| build-doc: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v7 | ||
| with: | ||
| python-version: "3.9" | ||
|
|
||
| - name: Install system dependencies | ||
| run: sudo apt-get update && sudo apt-get install rename | ||
|
|
||
| - name: Install doc dependencies | ||
| run: | | ||
| cd doc | ||
| uv venv | ||
| source .venv/bin/activate | ||
| uv pip install -r requirements.txt | ||
|
|
||
| - name: Install plotly in editable mode | ||
| if: github.ref_name != 'doc-prod' | ||
| run: | | ||
| cd doc | ||
| source .venv/bin/activate | ||
| uv pip uninstall plotly | ||
| uv pip install -e .. | ||
|
|
||
| - name: List installed packages | ||
| run: | | ||
| cd doc | ||
| source .venv/bin/activate | ||
| uv pip list | ||
|
|
||
| - name: Build HTML docs | ||
| env: | ||
| MAPBOX_TOKEN: ${{ secrets.MAPBOX_TOKEN }} | ||
| run: | | ||
| cd doc | ||
| source .venv/bin/activate | ||
| echo "${MAPBOX_TOKEN}" > python/.mapbox_token | ||
| make -kj8 || make -kj8 | ||
| curl https://raw.githubusercontent.com/plotly/graphing-library-docs/master/front-matter-ci.py > front-matter-ci.py | ||
| curl https://raw.githubusercontent.com/plotly/graphing-library-docs/master/check-or-enforce-order.py > check-or-enforce-order.py | ||
| python front-matter-ci.py build/html | ||
| python check-or-enforce-order.py build/html | ||
|
|
||
| - name: Upload HTML docs artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: doc-html | ||
| path: doc/build/html/ | ||
|
|
||
| - name: Create GitHub App token | ||
| if: github.ref_name == 'doc-prod' && github.event_name == 'push' | ||
| uses: actions/create-github-app-token@v2 | ||
| id: app-token | ||
| with: | ||
| app-id: ${{ vars.GRAPHING_LIBRARIES_CI_GHAPP_ID }} | ||
| private-key: ${{ secrets.GRAPHING_LIBRARIES_CI_GHAPP_PRIVATE_KEY }} | ||
| owner: ${{ github.repository_owner }} | ||
| repositories: plotly.py-docs,graphing-library-docs | ||
|
|
||
| - name: Checkout plotly.py-docs (built) | ||
| if: github.ref_name == 'doc-prod' && github.event_name == 'push' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any way to chain these steps together, or nest them under a single |
||
| uses: actions/checkout@v6 | ||
| with: | ||
| repository: plotly/plotly.py-docs | ||
| ref: built | ||
| token: ${{ steps.app-token.outputs.token }} | ||
| path: plotly.py-docs-html | ||
|
|
||
| - name: Deploy HTML docs | ||
| if: github.ref_name == 'doc-prod' && github.event_name == 'push' | ||
| run: | | ||
| git config --global user.name plotlydocbot | ||
| git config --global user.email accounts@plot.ly | ||
| rm -rf plotly.py-docs-html/* | ||
| cp -r doc/build/html/* plotly.py-docs-html/ | ||
| cd plotly.py-docs-html | ||
| git add . | ||
| git commit -m "build of https://github.com/plotly/plotly.py/commit/${{ github.sha }}" || echo "No changes to commit" | ||
| git push --force | ||
|
|
||
| - name: Checkout plotly.py-docs (built_ipynb) | ||
| if: github.ref_name == 'doc-prod' && github.event_name == 'push' | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| repository: plotly/plotly.py-docs | ||
| ref: built_ipynb | ||
| token: ${{ steps.app-token.outputs.token }} | ||
| path: plotly.py-docs-ipynb | ||
|
|
||
| - name: Deploy notebooks | ||
| if: github.ref_name == 'doc-prod' && github.event_name == 'push' | ||
| run: | | ||
| rm -rf plotly.py-docs-ipynb/* | ||
| cp -r doc/build/ipynb/* plotly.py-docs-ipynb/ | ||
| cd plotly.py-docs-ipynb | ||
| git add . | ||
| git commit -m "build of https://github.com/plotly/plotly.py/commit/${{ github.sha }}" || echo "No changes to commit" | ||
| git push --force | ||
|
|
||
| - name: Checkout graphing-library-docs | ||
| if: github.ref_name == 'doc-prod' && github.event_name == 'push' | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| repository: plotly/graphing-library-docs | ||
| ref: master | ||
| token: ${{ steps.app-token.outputs.token }} | ||
| path: graphing-library-docs | ||
|
|
||
| - name: Trigger downstream doc build | ||
| if: github.ref_name == 'doc-prod' && github.event_name == 'push' | ||
| run: | | ||
| cd graphing-library-docs | ||
| git commit --allow-empty -m "deploying https://github.com/plotly/plotly.py/commit/${{ github.sha }}" | ||
| git push | ||
|
|
||
| - name: Build API docs | ||
| if: github.ref_name == 'doc-prod' && github.event_name == 'push' | ||
| run: | | ||
| cd doc | ||
| source .venv/bin/activate | ||
| # For the API doc, we need to use the local version of plotly | ||
| # since we are tweaking the source because of | ||
| # graph_objs/graph_objects | ||
| uv pip uninstall plotly | ||
| uv pip install -e .. | ||
| cd apidoc | ||
| make html | ||
|
|
||
| - name: Checkout plotly.py-docs (gh-pages) | ||
| if: github.ref_name == 'doc-prod' && github.event_name == 'push' | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| repository: plotly/plotly.py-docs | ||
| ref: gh-pages | ||
| token: ${{ steps.app-token.outputs.token }} | ||
| path: plotly.py-docs-api | ||
|
|
||
| - name: Deploy API docs | ||
| if: github.ref_name == 'doc-prod' && github.event_name == 'push' | ||
| run: | | ||
| rm -rf plotly.py-docs-api/* | ||
| cp -r doc/apidoc/_build/html/* plotly.py-docs-api/ | ||
| touch plotly.py-docs-api/.nojekyll | ||
| cd plotly.py-docs-api | ||
| git add . | ||
| git commit -m "build of https://github.com/plotly/plotly.py/commit/${{ github.sha }}" || echo "No changes to commit" | ||
| git push --force | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LiamConnors Curious why we need to create a new token as part of the workflow — is it because the token is very short-lived?