Repository navigation
212 lines (193 loc) · 6.69 KB
/
Copy pathgatekeeper.yml
File metadata and controls
212 lines (193 loc) · 6.69 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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
name: CI Gatekeeper
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
concurrency:
group: ci-gatekeeper-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
js: ${{ steps.filter.outputs.js }}
contracts: ${{ steps.filter.outputs.contracts }}
agw-client: ${{ steps.filter.outputs.agw-client }}
publish-surface: ${{ steps.filter.outputs.publish-surface }}
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Paths filter
id: filter
uses: dorny/paths-filter@d1c1ffe0248fe513906c8e24db8ea791d46f8590 # v3
with:
filters: |
js:
- 'package.json'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- 'turbo.json'
- 'tsconfig.base.json'
- 'biome.json'
- 'vitest.workspace.ts'
- '.npmrc'
- 'packages/**'
- 'apps/**'
- 'examples/**'
- '.github/scripts/**'
- '.github/workflows/ci-verify.yml'
- '.github/workflows/gatekeeper.yml'
contracts:
- 'packages/contracts/**'
- '.github/workflows/ci-contracts.yml'
- '.github/workflows/gatekeeper.yml'
agw-client:
- 'packages/agw-client/**'
- '.github/workflows/ci-agw-client.yml'
- '.github/workflows/gatekeeper.yml'
publish-surface:
- 'package.json'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- 'turbo.json'
- 'tsconfig.base.json'
- 'biome.json'
- 'vitest.workspace.ts'
- '.npmrc'
- '.changeset/**'
- 'packages/mpp/**'
- 'packages/agw-client/**'
- 'packages/agw-react/**'
- 'packages/agw-thirdweb/**'
- 'packages/agw-web/**'
- 'packages/web3-react-agw/**'
- 'packages/agw-cli/**'
- '.github/scripts/**'
- '.github/workflows/ci-release-surface.yml'
- '.github/workflows/release-pr.yml'
- '.github/workflows/publish.yml'
- '.github/workflows/gatekeeper.yml'
detect-publishable:
name: Detect publishable release
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
outputs:
should_publish: ${{ steps.detect.outputs.should_publish }}
packages_json: ${{ steps.detect.outputs.packages_json }}
summary_markdown: ${{ steps.detect.outputs.summary_markdown }}
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
- name: Detect publishable packages
id: detect
run: node .github/scripts/detect-publishable.mjs
changesets:
name: Changeset Check
if: github.event_name == 'pull_request' && !startsWith(github.head_ref, 'changeset-release/') && needs.changes.outputs.publish-surface == 'true'
needs: changes
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
with:
package_json_file: package.json
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Require changeset for publishable changes
run: |
git fetch origin "${{ github.base_ref }}" --depth=1
pnpm exec changeset status --since="origin/${{ github.base_ref }}"
verify:
needs: changes
if: github.event_name == 'workflow_dispatch' || needs.changes.outputs.js == 'true'
uses: ./.github/workflows/ci-verify.yml
with:
event_name: ${{ github.event_name }}
secrets: inherit
contracts:
needs: changes
if: github.event_name == 'workflow_dispatch' || needs.changes.outputs.contracts == 'true'
uses: ./.github/workflows/ci-contracts.yml
secrets: inherit
agw-client:
needs:
- changes
- detect-publishable
if: |
always() &&
needs.changes.result == 'success' &&
(github.event_name == 'workflow_dispatch' ||
needs.changes.outputs.agw-client == 'true' ||
needs.detect-publishable.outputs.should_publish == 'true')
uses: ./.github/workflows/ci-agw-client.yml
secrets: inherit
release-surface:
needs:
- changes
- detect-publishable
if: |
always() &&
needs.changes.result == 'success' &&
(github.event_name == 'workflow_dispatch' ||
needs.changes.outputs.publish-surface == 'true' ||
needs.detect-publishable.outputs.should_publish == 'true')
uses: ./.github/workflows/ci-release-surface.yml
secrets: inherit
publish:
name: Publish
needs:
- detect-publishable
- release-surface
- agw-client
if: |
github.event_name == 'push' &&
github.ref == 'refs/heads/main' &&
needs.detect-publishable.outputs.should_publish == 'true' &&
needs.release-surface.result == 'success' &&
needs.agw-client.result == 'success'
permissions:
contents: write
id-token: write
uses: ./.github/workflows/publish.yml
secrets: inherit
ci-gatekeeper:
name: CI Gatekeeper
runs-on: ubuntu-latest
if: always()
needs:
- changesets
- verify
- contracts
- agw-client
- release-surface
- detect-publishable
- publish
steps:
- name: Verify job results
run: |
set -euo pipefail
results="${{ needs.changesets.result || 'skipped' }} ${{ needs.verify.result || 'skipped' }} ${{ needs.contracts.result || 'skipped' }} ${{ needs.agw-client.result || 'skipped' }} ${{ needs.release-surface.result || 'skipped' }} ${{ needs.detect-publishable.result || 'skipped' }} ${{ needs.publish.result || 'skipped' }}"
echo "Job results: $results"
if [[ "$results" =~ failure || "$results" =~ cancelled ]]; then
echo "One or more required jobs failed or were cancelled."
exit 1
fi