name: Release Dry Run

on:
  push:
    branches:
      - main
      - master
  workflow_dispatch:

jobs:
  release-dry-run:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Check release docs
        run: test -f docs/release-checklist.md && test -f docs/security-review.md && test -f CHANGELOG.md

      - name: Check unresolved placeholders
        run: |
          ! grep -RInE "[P]ROJECT_NAME|[P]ROJECT_DESCRIPTION|[R]EPOSITORY_OWNER|[R]EPOSITORY_NAME|[B]UILD_COMMAND|[T]EST_COMMAND|[L]INT_COMMAND" -- . --exclude-dir=.git --exclude-dir=node_modules --exclude-dir=.next

      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: "22"

      - name: Install dependencies
        run: npm install

      - name: Release check
        run: npm run release:check
