add snapshots #15
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
| name: Build and Deploy | |
| on: | |
| push: | |
| branches: | |
| - update-ci | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '2.7' | |
| bundler-cache: true | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install Python dependencies | |
| run: | | |
| pip install PyYAML==6.0.1 | |
| pip install python-frontmatter==0.5.0 | |
| - name: Fetch upstream docs | |
| run: | | |
| rm -rf _posts/python/html _posts/julia/html _posts/fsharp/html _posts/csharp/html _posts/r/md _posts/ggplot2/md _posts/matlab/md | |
| git clone --depth 1 -b built https://github.com/plotly/plotly.py-docs _posts/python/html | |
| git clone --depth 1 -b built https://github.com/plotly/plotlyjs.jl-docs _posts/julia/html | |
| git clone --depth 1 -b built https://github.com/plotly/plotly.net-docs _posts/fsharp/html | |
| git clone --depth 1 -b built https://github.com/plotly/plotly.r-docs _posts/r/md | |
| git clone --depth 1 -b built https://github.com/plotly/plotly.matlab-docs _posts/matlab/md | |
| mv _posts/r/md/ggplot2 _posts/ggplot2/md | |
| mv _posts/fsharp/html/csharp _posts/csharp/html | |
| - name: Fix case-sensitive redirect issues | |
| run: python fix-case-redirects.py _posts/julia/html | |
| - name: Build site | |
| run: | | |
| python front-matter-ci.py _posts | |
| python check-or-enforce-order.py _posts/python | |
| python check-or-enforce-order.py _posts/python-v3 | |
| python check-or-enforce-order.py _posts/r/ | |
| python check-or-enforce-order.py _posts/matlab | |
| python check-or-enforce-order.py _posts/plotly_js | |
| python generate-sitemaps.py | |
| md5sum all_static/css/main.css | cut -d ' ' -f 1 > _data/cache_bust_css.yml | |
| bundle exec jekyll build | |
| cp python/sitemap.xml _site/python/sitemap.xml | |
| - name: Create Percy snapshots | |
| run: | | |
| mkdir snapshots | |
| cd _site | |
| cp -r 'all_static' '../snapshots' | |
| cp 'api/index.html' '../snapshots' | |
| cp --parents 'python/index.html' '../snapshots' | |
| cp --parents 'python/getting-started/index.html' '../snapshots' | |
| cp --parents 'python/plotly-fundamentals/index.html' '../snapshots' | |
| cp --parents 'python/line-and-scatter/index.html' '../snapshots' | |
| cp --parents 'r/index.html' '../snapshots' | |
| cp --parents 'r/getting-started/index.html' '../snapshots' | |
| cp --parents 'r/plotly-fundamentals/index.html' '../snapshots' | |
| cp --parents 'r/line-and-scatter/index.html' '../snapshots' | |
| cp --parents 'javascript/index.html' '../snapshots' | |
| cp --parents 'javascript/plotly-fundamentals/index.html' '../snapshots' | |
| cp --parents 'javascript/getting-started/index.html' '../snapshots' | |
| cp --parents 'javascript/line-and-scatter/index.html' '../snapshots' | |
| cp --parents 'ggplot2/index.html' '../snapshots' | |
| cp --parents 'ggplot2/getting-started/index.html' '../snapshots' | |
| cp --parents 'ggplot2/histograms/index.html' '../snapshots' | |
| cp --parents 'matlab/index.html' '../snapshots' | |
| cp --parents 'matlab/getting-started/index.html' '../snapshots' | |
| cp --parents 'matlab/graphing-multiple-chart-types/index.html' '../snapshots' | |
| cp --parents 'matlab/histograms/index.html' '../snapshots' | |
| cp --parents 'csharp/index.html' '../snapshots' | |
| cp --parents 'csharp/getting-started/index.html' '../snapshots' | |
| cd .. | |
| rm -f 'snapshots/all_static/javascripts/jquery-knob/index.html' | |
| rm -f 'snapshots/all_static/images/Plotly-feed2.html' | |
| rm -f 'snapshots/all_static/images/Plotly.html' | |
| rm -f 'snapshots/all_static/images/Plotly-Feed.html' | |
| rm -f snapshots/*.bkp snapshots/*/*.bkp snapshots/*/*/*.bkp | |
| - name: Percy snapshot | |
| run: bundle exec percy snapshot snapshots --enable_javascript | |
| env: | |
| PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} | |
| - name: Zip site | |
| run: zip -r site-build-github-actions.zip _site/ | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: site-build-github-actions | |
| path: site-build-github-actions.zip |