github-pages #159
This file contains 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: Deploy index.html | |
on: | |
workflow_dispatch: | |
repository_dispatch: | |
event_type: github-pages | |
push: | |
branches: | |
- "main" | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: false | |
jobs: | |
deploy-index: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Initialize Pants launcher | |
uses: pantsbuild/actions/init-pants@56efcdb79721bc7726edf542e324468033e4e21c | |
with: | |
# cache0 makes it easy to bust the cache if needed | |
gha-cache-key: cache0-py3.9 | |
named-caches-hash: ${{ hashFiles('3rdparty/python/default.lock') }} | |
- name: Generate index | |
run: | | |
mkdir -p github-pages | |
pants run :generate_index -- --url-path-prefix=/simple github-pages/simple | |
# Experiment: Generate a distinct index without legacy top-level links for recent Pants versions. | |
pants run :generate_index -- --url-path-prefix=/edge/simple --exclude-legacy-links github-pages/edge/simple | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: github-pages | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |