Files
awesome-python/.github/workflows/deploy-website.yml
T
Vinta ChenandClaude cc804b1de2 feat: add Downloads/Month column to website table
Sourced from website/data/pypi_downloads.tsv the same way
github_stars.json feeds the stars column. The new sortable column
sits between GitHub Stars and Last Commit on the homepage and
category pages, formatted with thousands separators like stars, with
an em dash when no PyPI data exists. Rows are matched by normalized
README display name; Built-in entries never show counts since
same-named PyPI packages are stdlib backports (e.g. the asyncio
package).

Below 960px the column hides and the count moves into the expand
row, mirroring the existing Last Commit treatment. main.js gains the
downloads sort branch and URL param.

The deploy workflow fetches the TSV via the new
make fetch_pypi_downloads target with a daily actions/cache
fallback, mirroring the stars fetch, but non-fatal: the column
degrades to dashes when the fetch fails, unlike stars which the
build requires.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-16 17:52:04 +08:00

103 lines
2.7 KiB
YAML

name: Deploy Website
on:
push:
branches: [master]
schedule:
- cron: "0 0 * * *"
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
deploy:
if: github.repository == 'vinta/awesome-python'
runs-on: ubuntu-latest
environment:
name: github-pages
url: https://awesome-python.com/
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Install dependencies
run: uv sync --group build --locked
- name: Run tests
if: github.event_name == 'schedule'
run: make test
- name: Get date
id: date
run: echo "today=$(date -u +%Y-%m-%d)" >> "$GITHUB_OUTPUT"
- name: Restore star data cache
id: cache-stars
uses: actions/cache/restore@v4
with:
path: website/data/github_stars.json
key: github-stars-${{ steps.date.outputs.today }}
restore-keys: github-stars-
- name: Fetch GitHub stars
id: fetch-stars
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make fetch_github_stars
- name: Save star data cache
if: steps.fetch-stars.outcome == 'success'
uses: actions/cache/save@v4
with:
path: website/data/github_stars.json
key: github-stars-${{ steps.date.outputs.today }}
- name: Verify star data exists
run: |
if [ ! -f website/data/github_stars.json ]; then
echo "::error::github_stars.json not found. No cache and fetch failed or was skipped."
exit 1
fi
python -m json.tool website/data/github_stars.json > /dev/null
- name: Restore PyPI download data cache
uses: actions/cache/restore@v4
with:
path: website/data/pypi_downloads.tsv
key: pypi-downloads-${{ steps.date.outputs.today }}
restore-keys: pypi-downloads-
- name: Fetch PyPI downloads
id: fetch-downloads
continue-on-error: true
run: make fetch_pypi_downloads
- name: Save PyPI download data cache
if: steps.fetch-downloads.outcome == 'success'
uses: actions/cache/save@v4
with:
path: website/data/pypi_downloads.tsv
key: pypi-downloads-${{ steps.date.outputs.today }}
- name: Build website
run: make build
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: website/output/
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4