diff --git a/.github/workflows/eclipse-publish.yml b/.github/workflows/eclipse-publish.yml new file mode 100644 index 0000000000..62bc0f40b0 --- /dev/null +++ b/.github/workflows/eclipse-publish.yml @@ -0,0 +1,135 @@ +name: Release + +on: + push: + branches: + - main + +permissions: + contents: write + id-token: write + +concurrency: + group: release-${{ github.ref }} + cancel-in-progress: false + +jobs: + release: + name: Release to npm + if: "startsWith(github.event.head_commit.message, 'chore(eclipse): release ')" + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Extract version from commit message + id: version + run: | + VERSION=$(echo "${{ github.event.head_commit.message }}" | sed -E 's/^chore\(eclipse\): release ([0-9]+\.[0-9]+\.[0-9]+).*/\1/') + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "Releasing version: $VERSION" + + - name: Validate version format + run: | + VERSION="${{ steps.version.outputs.version }}" + if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Error: Invalid version format '$VERSION'. Expected x.y.z" + exit 1 + fi + + - name: Verify package version matches commit + run: | + VERSION="${{ steps.version.outputs.version }}" + PACKAGE_VERSION=$(node -e "const fs=require('fs');const p=JSON.parse(fs.readFileSync('packages/eclipse/package.json','utf8'));process.stdout.write(p.version)") + if [[ "$PACKAGE_VERSION" != "$VERSION" ]]; then + echo "Error: packages/eclipse/package.json version is '$PACKAGE_VERSION' but commit version is '$VERSION'" + exit 1 + fi + + - name: Check if version already exists on npm + id: check-version + run: | + VERSION="${{ steps.version.outputs.version }}" + if npm view @prisma/eclipse@$VERSION version >/dev/null 2>&1; then + echo "Version $VERSION already exists on npm" + echo "exists=true" >> "$GITHUB_OUTPUT" + else + echo "Version $VERSION is new" + echo "exists=false" >> "$GITHUB_OUTPUT" + fi + + - name: Setup pnpm + if: steps.check-version.outputs.exists == 'false' + uses: pnpm/action-setup@v4 + + - name: Setup Node.js + if: steps.check-version.outputs.exists == 'false' + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "pnpm" + registry-url: "https://registry.npmjs.org" + + - name: Ensure npm version for trusted publishing + if: steps.check-version.outputs.exists == 'false' + run: | + npm install -g npm@11.5.1 + echo "Node: $(node --version)" + echo "npm: $(npm --version)" + + - name: Install dependencies + if: steps.check-version.outputs.exists == 'false' + run: pnpm install --frozen-lockfile + + - name: Typecheck + if: steps.check-version.outputs.exists == 'false' + run: pnpm --filter @prisma/eclipse run types:check + + - name: Verify publish dry run + if: steps.check-version.outputs.exists == 'false' + working-directory: packages/eclipse + run: npm publish --dry-run --access public + + - name: Publish to npm + if: steps.check-version.outputs.exists == 'false' + working-directory: packages/eclipse + run: npm publish --access public + + - name: Create and push git tag + if: steps.check-version.outputs.exists == 'false' + run: | + VERSION="${{ steps.version.outputs.version }}" + TAG="eclipse-v$VERSION" + if ! git rev-parse "$TAG" >/dev/null 2>&1; then + git tag "$TAG" + git push origin "$TAG" + else + echo "Tag $TAG already exists, skipping" + fi + + - name: Create GitHub Release + if: steps.check-version.outputs.exists == 'false' + run: | + VERSION="${{ steps.version.outputs.version }}" + TAG="eclipse-v$VERSION" + if ! gh release view "$TAG" >/dev/null 2>&1; then + gh release create "$TAG" --title "@prisma/eclipse v$VERSION" --generate-notes + else + echo "Release $TAG already exists, skipping" + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Release summary + if: steps.check-version.outputs.exists == 'false' + run: | + VERSION="${{ steps.version.outputs.version }}" + TAG="eclipse-v$VERSION" + echo "## Release @prisma/eclipse v$VERSION complete" >> "$GITHUB_STEP_SUMMARY" + echo "" >> "$GITHUB_STEP_SUMMARY" + echo "- Tag: $TAG" >> "$GITHUB_STEP_SUMMARY" + echo "- GitHub release: https://github.com/${{ github.repository }}/releases/tag/$TAG" >> "$GITHUB_STEP_SUMMARY" + echo "- https://www.npmjs.com/package/@prisma/eclipse/v/$VERSION" >> "$GITHUB_STEP_SUMMARY" \ No newline at end of file diff --git a/README.md b/README.md index f66ab6e02b..7d50d06696 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This repository is a **pnpm monorepo** containing the Prisma documentation, blog | `apps/docs` | Prisma documentation site (Next.js + Fumadocs) | | `apps/blog` | Prisma blog | | `apps/eclipse` | Eclipse design system documentation | -| `packages/eclipse` | Eclipse design system component library (`@prisma-docs/eclipse`) | +| `packages/eclipse` | Eclipse design system component library (`@prisma/eclipse`) | | `packages/ui` | Shared UI components and utilities (`@prisma-docs/ui`) | See each app’s `README.md` for more detail. diff --git a/apps/blog/README.md b/apps/blog/README.md index bf62aba4d1..598f51565c 100644 --- a/apps/blog/README.md +++ b/apps/blog/README.md @@ -22,7 +22,7 @@ Runs on **http://localhost:3001** (docs is 3000, eclipse is 3002). - `content/blog/` — MDX blog posts - `src/` — App shell, layout, search, and MDX components (TweetEmbed, Youtube, Quote, etc.) - Uses [Fumadocs](https://fumadocs.dev) for the blog framework -- Uses `@prisma-docs/eclipse` for UI components +- Uses `@prisma/eclipse` for UI components ## Related diff --git a/apps/blog/next.config.mjs b/apps/blog/next.config.mjs index e602f6fb70..42bd5e95a5 100644 --- a/apps/blog/next.config.mjs +++ b/apps/blog/next.config.mjs @@ -226,7 +226,7 @@ const config = { allowedDevOrigins, reactStrictMode: true, images: { unoptimized: true }, - transpilePackages: ["@prisma-docs/eclipse"], + transpilePackages: ["@prisma/eclipse"], experimental: { globalNotFound: true, }, diff --git a/apps/blog/package.json b/apps/blog/package.json index c79e8e1032..c74a92db23 100644 --- a/apps/blog/package.json +++ b/apps/blog/package.json @@ -15,7 +15,7 @@ "dependencies": { "@base-ui/react": "catalog:", "@fumadocs/cli": "catalog:", - "@prisma-docs/eclipse": "workspace:^", + "@prisma/eclipse": "workspace:^", "@prisma-docs/ui": "workspace:*", "fumadocs-core": "catalog:", "fumadocs-mdx": "catalog:", diff --git a/apps/blog/src/app/(blog)/page.tsx b/apps/blog/src/app/(blog)/page.tsx index 38316e580d..1c8e019810 100644 --- a/apps/blog/src/app/(blog)/page.tsx +++ b/apps/blog/src/app/(blog)/page.tsx @@ -1,7 +1,7 @@ import { Suspense } from "react"; import { blog } from "@/lib/source"; import { BlogGrid } from "@/components/BlogGrid"; -import { Avatar, Badge, Card } from "@prisma-docs/eclipse"; +import { Avatar, Badge, Card } from "@prisma/eclipse"; import { getCardImageSrc } from "@/lib/source"; export default function BlogHome() { const posts = blog.getPages().sort((a, b) => { diff --git a/apps/blog/src/app/global.css b/apps/blog/src/app/global.css index 1990e0cb22..6937009cb9 100644 --- a/apps/blog/src/app/global.css +++ b/apps/blog/src/app/global.css @@ -1,5 +1,5 @@ @import "tailwindcss"; -@import "@prisma-docs/eclipse/styles/globals.css"; +@import "@prisma/eclipse/styles/globals.css"; @import "fumadocs-ui/css/shadcn.css"; @import "fumadocs-ui/css/preset.css"; @import "fumadocs-openapi/css/preset.css"; diff --git a/apps/blog/src/components/BlogGrid.tsx b/apps/blog/src/components/BlogGrid.tsx index 584798a680..67d1f5a76d 100644 --- a/apps/blog/src/components/BlogGrid.tsx +++ b/apps/blog/src/components/BlogGrid.tsx @@ -15,7 +15,7 @@ import { PaginationLink, PaginationNext, PaginationPrevious, -} from "@prisma-docs/eclipse"; +} from "@prisma/eclipse"; import { withBlogBasePathForImageSrc } from "@/lib/url"; import { formatTag, formatDate } from "@/lib/format"; diff --git a/apps/blog/src/mdx-components.tsx b/apps/blog/src/mdx-components.tsx index 117d661d48..b6b2992948 100644 --- a/apps/blog/src/mdx-components.tsx +++ b/apps/blog/src/mdx-components.tsx @@ -22,7 +22,7 @@ import { TabsList, TabsTrigger, Steps,Step -} from "@prisma-docs/eclipse"; +} from "@prisma/eclipse"; import { TweetEmbedComp } from "@/components/TweetEmbed"; import { Youtube } from "@/components/Youtube"; import { Meetup, MeetupList } from "@/components/Meetup"; diff --git a/apps/docs/README.md b/apps/docs/README.md index bf6a5eaef4..c6a5faaece 100644 --- a/apps/docs/README.md +++ b/apps/docs/README.md @@ -76,7 +76,7 @@ Run these from the repo root with `pnpm --filter docs