name: Pages

# Publishes the demo site (index.html + every component's examples.html,
# served against the committed dist/ bundle) to GitHub Pages on every push
# to main: https://vanilla-ui-kit.github.io/components/

on:
  push:
    branches: [main]
  workflow_dispatch:

permissions:
  contents: read
  pages: write
  id-token: write

concurrency:
  group: pages
  cancel-in-progress: true

jobs:
  deploy:
    runs-on: ubuntu-latest
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - uses: actions/checkout@v4

      - uses: actions/configure-pages@v5
        with:
          enablement: true

      # The site is the repository itself — index.html at the root links to
      # each component's examples.html, which load their sibling source files.
      - uses: actions/upload-pages-artifact@v3
        with:
          path: .

      - id: deployment
        uses: actions/deploy-pages@v4
