chore: update #570
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Registry | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - '.github/actions/**' | |
| - '.github/workflows/registry.yml' | |
| - 'apps/www/package.json' | |
| - 'apps/www/scripts/**' | |
| - 'apps/www/src/app/globals.css' | |
| - 'apps/www/src/registry/**' | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| paths: | |
| - '.github/actions/**' | |
| - '.github/workflows/registry.yml' | |
| - 'apps/www/package.json' | |
| - 'apps/www/scripts/**' | |
| - 'apps/www/src/app/globals.css' | |
| - 'apps/www/src/registry/**' | |
| permissions: | |
| contents: write | |
| jobs: | |
| validate-registry: | |
| name: Validate Registry | |
| runs-on: ubuntu-latest | |
| if: >- | |
| github.event_name == 'pull_request' && | |
| github.repository == 'udecode/plate' && | |
| ( | |
| github.event.pull_request.head.repo.full_name != github.repository || | |
| !startsWith(github.event.pull_request.head.ref, 'changeset-release/') | |
| ) | |
| concurrency: | |
| group: ${{ github.workflow }}-validate-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| steps: | |
| - name: π₯ Checkout Repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: π Detect pending changesets | |
| id: changesets | |
| run: | | |
| pending_changesets="$(find .changeset -maxdepth 1 -type f -name '*.md' ! -name 'README.md' -print)" | |
| if [[ -n "$pending_changesets" ]]; then | |
| echo "Pending changesets found:" | |
| echo "$pending_changesets" | |
| echo "present=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "present=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: βοΈ Skip registry validation | |
| if: ${{ steps.changesets.outputs.present == 'true' }} | |
| run: echo "Skipping registry validation while package changesets are pending." | |
| - name: β»οΈ Setup Node.js | |
| if: ${{ steps.changesets.outputs.present != 'true' }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - uses: oven-sh/setup-bun@v2 | |
| if: ${{ steps.changesets.outputs.present != 'true' }} | |
| name: Install bun | |
| with: | |
| bun-version: 1.3.9 | |
| - name: π¦ Monorepo install | |
| if: ${{ steps.changesets.outputs.present != 'true' }} | |
| uses: ./.github/actions/pnpm-install | |
| with: | |
| link-workspace-packages: 'true' | |
| - name: π Build Registry | |
| if: ${{ steps.changesets.outputs.present != 'true' }} | |
| run: pnpm --filter www build:registry && pnpm --filter www build:tw | |
| - name: π Build local dev registry | |
| if: ${{ steps.changesets.outputs.present != 'true' }} | |
| run: pnpm --filter www rd | |
| - name: π Update templates | |
| if: ${{ steps.changesets.outputs.present != 'true' }} | |
| env: | |
| TEMPLATE_SKIP_VERIFY: 'true' | |
| run: pnpm templates:update --local | |
| - name: π¦ Override templates with local workspace packages | |
| if: ${{ steps.changesets.outputs.present != 'true' }} | |
| env: | |
| TEMPLATE_LOCAL_PACKAGE_BASE_REF: origin/${{ github.base_ref }} | |
| run: | | |
| node tooling/scripts/prepare-local-template-packages.mjs \ | |
| templates/plate-template \ | |
| templates/plate-playground-template | |
| - name: β Run template CI | |
| if: ${{ steps.changesets.outputs.present != 'true' }} | |
| run: | | |
| cd templates/plate-template | |
| bun install --no-frozen-lockfile | |
| bun run build | |
| cd ../plate-playground-template | |
| bun install --no-frozen-lockfile | |
| bun run build | |
| update-registry: | |
| name: Update Registry | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name == 'push' && github.repository == 'udecode/plate' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, '[skip release]') }} | |
| concurrency: | |
| group: ${{ github.workflow }}-publish-${{ github.ref }} | |
| cancel-in-progress: true | |
| steps: | |
| - name: π₯ Checkout Repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.API_TOKEN_GITHUB || secrets.GITHUB_TOKEN }} | |
| - name: π Detect pending changesets | |
| id: changesets | |
| run: | | |
| pending_changesets="$(find .changeset -maxdepth 1 -type f -name '*.md' ! -name 'README.md' -print)" | |
| if [[ -n "$pending_changesets" ]]; then | |
| echo "Pending changesets found:" | |
| echo "$pending_changesets" | |
| echo "present=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "present=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: β»οΈ Setup Node.js | |
| if: ${{ steps.changesets.outputs.present != 'true' }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - uses: oven-sh/setup-bun@v2 | |
| if: ${{ steps.changesets.outputs.present != 'true' }} | |
| name: Install bun | |
| with: | |
| bun-version: 1.3.9 | |
| - name: π¦ Monorepo install | |
| if: ${{ steps.changesets.outputs.present != 'true' }} | |
| uses: ./.github/actions/pnpm-install | |
| with: | |
| link-workspace-packages: 'true' | |
| - name: π§ Configure git | |
| if: ${{ steps.changesets.outputs.present != 'true' }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| - name: π Build Registry | |
| if: ${{ steps.changesets.outputs.present != 'true' }} | |
| run: pnpm --filter www build:registry && pnpm --filter www build:tw | |
| - name: π Build local dev registry | |
| if: ${{ steps.changesets.outputs.present != 'true' }} | |
| run: pnpm --filter www rd | |
| - name: π Update templates | |
| if: ${{ steps.changesets.outputs.present != 'true' }} | |
| env: | |
| TEMPLATE_SKIP_VERIFY: 'true' | |
| run: pnpm templates:update --local | |
| - name: π Detect template changes | |
| if: ${{ steps.changesets.outputs.present != 'true' }} | |
| id: template-changes | |
| run: | | |
| if [[ -n "$(git status --porcelain --untracked-files=all -- templates)" ]]; then | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: β Run template CI | |
| if: ${{ steps.changesets.outputs.present != 'true' && steps.template-changes.outputs.changed == 'true' }} | |
| run: | | |
| cd templates/plate-template | |
| bun install --no-frozen-lockfile | |
| bun run build | |
| cd ../plate-playground-template | |
| bun install --no-frozen-lockfile | |
| bun run build | |
| - name: β¬οΈ Push registry updates | |
| if: ${{ steps.changesets.outputs.present != 'true' }} | |
| run: | | |
| git add . | |
| if git diff --cached --quiet; then | |
| echo "No registry changes to publish." | |
| exit 0 | |
| fi | |
| git commit -m "chore: sync registry and templates [skip release]" | |
| git push origin HEAD:main |