Skip to content

Merge pull request #43 from VectorInstitute/fix_metric_calc #49

Merge pull request #43 from VectorInstitute/fix_metric_calc

Merge pull request #43 from VectorInstitute/fix_metric_calc #49

name: Deploy Next.js Catalog to GitHub Pages
on:
push:
branches:
- main
paths:
- 'catalog/**'
- 'repositories/**'
- 'scripts/sync_repositories_to_json.py'
- '.github/workflows/deploy-catalog.yml'
workflow_dispatch:
# Auto-trigger when metrics are updated
workflow_run:
workflows: ["Collect GitHub Metrics"]
types:
- completed
branches:
- main
permissions:
contents: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build-and-deploy:
runs-on: ubuntu-latest
# Only deploy if metrics collection succeeded (or if triggered by push/manual)
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: catalog/package-lock.json
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.9.11"
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install Python dependencies
run: uv pip install --system pyyaml requests
- name: Sync YAML repositories to JSON
run: python scripts/sync_repositories_to_json.py
- name: Collect PyPI metrics
run: python scripts/collect_pypi_metrics.py
continue-on-error: true
- name: Install Node dependencies
working-directory: catalog
run: npm ci
- name: Build Next.js site
working-directory: catalog
run: npm run build:github
env:
NEXT_PUBLIC_BASE_PATH: "true"
- name: Ensure .nojekyll exists
run: touch catalog/out/.nojekyll
- name: Deploy to gh-pages branch
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./catalog/out
publish_branch: gh-pages
force_orphan: true