Skip to content

Commit aa4dabe

Browse files
authored
ci: Build packages in update workflow (#3380)
After #3322, generating LavaMoat policies requires the build files to be present. Since the examples step requires build files as well, I've moved the build to a new job which is now a requirement for the other steps.
1 parent 7cffbee commit aa4dabe

1 file changed

Lines changed: 43 additions & 3 deletions

File tree

.github/workflows/update-pull-request.yml

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,46 @@ jobs:
118118
name: yarn-lock-${{ needs.prepare.outputs.COMMIT_SHA }}
119119
path: yarn.lock
120120

121+
build:
122+
name: Build packages
123+
runs-on: ubuntu-latest
124+
needs:
125+
- prepare
126+
- dedupe-yarn-lock
127+
steps:
128+
- name: Checkout repository
129+
uses: actions/checkout@v4
130+
- name: Checkout pull request
131+
run: gh pr checkout "${PR_NUMBER}"
132+
env:
133+
GITHUB_TOKEN: ${{ secrets.PULL_REQUEST_UPDATE_TOKEN }}
134+
PR_NUMBER: ${{ inputs.pull-request != 0 && inputs.pull-request || github.event.issue.number }}
135+
- name: Restore yarn.lock
136+
uses: actions/download-artifact@v4
137+
with:
138+
name: yarn-lock-${{ needs.prepare.outputs.COMMIT_SHA }}
139+
- name: Checkout and setup environment
140+
uses: MetaMask/action-checkout-and-setup@v1
141+
with:
142+
# If the Yarn lock changed we need to reinstall the dependencies.
143+
is-high-risk-environment: ${{ needs.dedupe-yarn-lock.outputs.YARN_LOCK_CHANGED == 'true' }}
144+
- name: Build packages
145+
run: yarn build:ci
146+
- name: Save packages
147+
uses: actions/upload-artifact@v4
148+
with:
149+
name: packages-${{ needs.prepare.outputs.COMMIT_SHA }}
150+
path: |
151+
.nvmrc
152+
packages/*/dist
153+
121154
regenerate-lavamoat-policies:
122155
name: Regenerate LavaMoat policies
123156
runs-on: ubuntu-latest
124157
needs:
125158
- prepare
126159
- dedupe-yarn-lock
160+
- build
127161
steps:
128162
- name: Checkout repository
129163
uses: actions/checkout@v4
@@ -136,6 +170,10 @@ jobs:
136170
uses: actions/download-artifact@v4
137171
with:
138172
name: yarn-lock-${{ needs.prepare.outputs.COMMIT_SHA }}
173+
- name: Restore packages
174+
uses: actions/download-artifact@v4
175+
with:
176+
name: packages-${{ needs.prepare.outputs.COMMIT_SHA }}
139177
- name: Checkout and setup environment
140178
uses: MetaMask/action-checkout-and-setup@v1
141179
with:
@@ -157,6 +195,7 @@ jobs:
157195
needs:
158196
- prepare
159197
- dedupe-yarn-lock
198+
- build
160199
steps:
161200
- name: Checkout repository
162201
uses: actions/checkout@v4
@@ -169,14 +208,15 @@ jobs:
169208
uses: actions/download-artifact@v4
170209
with:
171210
name: yarn-lock-${{ needs.prepare.outputs.COMMIT_SHA }}
211+
- name: Restore packages
212+
uses: actions/download-artifact@v4
213+
with:
214+
name: packages-${{ needs.prepare.outputs.COMMIT_SHA }}
172215
- name: Checkout and setup environment
173216
uses: MetaMask/action-checkout-and-setup@v1
174217
with:
175218
# If the Yarn lock changed we need to reinstall the dependencies.
176219
is-high-risk-environment: ${{ needs.dedupe-yarn-lock.outputs.YARN_LOCK_CHANGED == 'true' }}
177-
- name: Build dependencies
178-
run: |
179-
yarn build:ci
180220
- name: Update examples
181221
run: yarn build:examples
182222
- name: Save examples

0 commit comments

Comments
 (0)