name: Deploy PostCSS Preset Env
on:
  workflow_dispatch:
  push:
    branches:
      - 'main'
    paths:
      -  'sites/package-lock.json'
      -  'sites/postcss-preset-env/**'

defaults:
  run:
    shell: bash

permissions:
  contents: read

jobs:
  build:
    name: Request Netlify Webhook
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
        with:
          fetch-depth: 1
      - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
        with:
          node-version: 26

      - name: npm ci
        run: |
          cd sites/postcss-preset-env
          npm ci --ignore-scripts

      - name: build
        run: |
          cd sites/postcss-preset-env
          npm run build

      - name: trigger deploy
        env:
          DEPLOY_HOOK: ${{ secrets.PRESET_ENV_DEPLOY_HOOK }}
        run: curl -X POST -d {} $DEPLOY_HOOK
