-
Notifications
You must be signed in to change notification settings - Fork 973
193 lines (161 loc) Β· 5.77 KB
/
registry.yml
File metadata and controls
193 lines (161 loc) Β· 5.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
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.title != '[Release] Version packages' }}
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: β»οΈ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- uses: oven-sh/setup-bun@v2
name: Install bun
with:
bun-version: 1.3.9
- name: π¦ Monorepo install
uses: ./.github/actions/pnpm-install
with:
link-workspace-packages: 'true'
- name: π Build Registry
run: pnpm --filter www build:registry && pnpm --filter www build:tw
- name: π Build local dev registry
run: pnpm --filter www rd
- name: π Update templates
env:
TEMPLATE_SKIP_VERIFY: 'true'
run: pnpm templates:update --local
- name: π¦ Override templates with local workspace packages
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
run: |
cd templates/plate-template
bun install --no-frozen-lockfile
bun lint
bun run build
cd ../plate-playground-template
bun install --no-frozen-lockfile
bun lint
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 lint
bun run build
cd ../plate-playground-template
bun install --no-frozen-lockfile
bun lint
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