| name: Publish Website |
| |
| on: |
| workflow_dispatch: |
| push: |
| branches: |
| - main |
| paths: |
| # Python/pip release index page. |
| - "build_tools/scripts/generate_release_index.py" |
| # Regenerate the release pip index when a release is created or deleted. |
| release: |
| types: [published, unpublished] |
| |
| jobs: |
| publish_website: |
| runs-on: ubuntu-20.04 |
| steps: |
| - name: Checkout out repository |
| uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 |
| with: |
| submodules: true |
| token: ${{ secrets.WRITE_ACCESS_TOKEN }} |
| - name: Fetching base gh-pages branch |
| # We have to explicitly fetch the gh-pages branch as well to preserve history |
| run: git fetch --no-tags --prune --depth=1 origin "gh-pages:gh-pages" |
| - name: Setting up Python |
| uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0 |
| with: |
| python-version: 3.x |
| cache: 'pip' |
| - name: Installing dependencies |
| run: | |
| pip install requests |
| - name: Generating release index |
| run: | |
| ./build_tools/scripts/generate_release_index.py \ |
| --repo="${GITHUB_REPOSITORY}" \ |
| --output=docs/website/pip-release-links.html |
| - name: Deploy |
| uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 |
| with: |
| github_token: ${{ secrets.WRITE_ACCESS_TOKEN }} |
| publish_dir: docs/website |