name: Preview Releases

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

permissions: {}

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
  publish:
    name: Publish Preview
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false
      - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
      - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
        with:
          node-version: 22
          cache: pnpm
      - run: pnpm install --frozen-lockfile
      - run: pnpm build
      - run: pnpm dlx pkg-pr-new publish --pnpm './packages/core' './packages/admin' './packages/auth' './packages/blocks' './packages/cloudflare' './packages/create-emdash' './packages/gutenberg-to-portable-text' './packages/x402' './packages/plugins/ai-moderation' './packages/plugins/atproto' './packages/plugins/audit-log' './packages/plugins/color' './packages/plugins/embeds' './packages/plugins/forms' './packages/plugins/webhook-notifier'
