@@ -120,10 +120,10 @@ jobs:
120
120
PACKAGES='${{ steps.changesets-main.outputs.publishedPackages}}'
121
121
PRIORITIZED_PACKAGES=$(echo $PACKAGES | jq -c '[.[] | select(.name == "pie-docs" or .name == "pie-storybook")]')
122
122
REST_PACKAGES=$(echo $PACKAGES | jq -c '[.[] | select((.name != "pie-docs" and .name != "pie-storybook") and (.name | startswith("wc-") | not) and .name != "pie-monorepo")]')
123
-
123
+
124
124
PRIORITIZED_BLOCKS=$(echo $PACKAGES | jq -c '
125
125
map(select(.name == "pie-docs" or .name == "pie-storybook")) |
126
-
126
+
127
127
if length > 0 then
128
128
[{"type": "divider"}, {"type": "header", "text": {"type": "plain_text", "text": ":rocket: Deployment Summary"}}] +
129
129
(map(
@@ -170,8 +170,8 @@ jobs:
170
170
.
171
171
end
172
172
')
173
-
174
-
173
+
174
+
175
175
REST_COMPONENT_BLOCKS=$(echo $REST_PACKAGES | jq -c '
176
176
if length > 0 then
177
177
[{"type": "divider"}] +
@@ -183,9 +183,9 @@ jobs:
183
183
[]
184
184
end
185
185
')
186
-
186
+
187
187
BLOCKS=$(echo "[${PRIORITIZED_BLOCKS},${REST_COMPONENT_BLOCKS}]" | jq -c 'add')
188
-
188
+
189
189
echo "BLOCKS=$BLOCKS" >> $GITHUB_ENV
190
190
191
191
- name : Send a Slack notification on publish
@@ -201,8 +201,9 @@ jobs:
201
201
}
202
202
env :
203
203
SLACK_BOT_TOKEN : ${{ secrets.SLACK_BOT_TOKEN }}
204
-
204
+
205
205
- name : Publish packages to CDN
206
+ id : cdn-publish
206
207
if : steps.changesets-main.outputs.published == 'true'
207
208
uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
208
209
env :
@@ -212,6 +213,66 @@ jobs:
212
213
PIE_CDN_BUCKET_NAME : ${{ vars.PIE_CDN_BUCKET_NAME }}
213
214
with :
214
215
script : |
215
- const publishedPackages = JSON.parse('${{ steps.changesets-main.outputs.publishedPackages }}');
216
- const publishToCdn = require('${{ github.workspace }}/packages/tools/pie-monorepo-utils/pie-cdn/publish-to-cdn.js');
217
- await publishToCdn({ publishedPackages });
216
+ try {
217
+ const publishedPackages = JSON.parse('${{ steps.changesets-main.outputs.publishedPackages }}');
218
+ const publishToCdn = require('${{ github.workspace }}/packages/tools/pie-monorepo-utils/pie-cdn/publish-to-cdn.js');
219
+ await publishToCdn({ publishedPackages });
220
+ } catch (error) {
221
+ core.setFailed(`CDN publish failed: ${error.message}`);
222
+ }
223
+
224
+ - name : Send Slack alert on CDN publish failure
225
+ if : failure() && steps.cdn-publish.outcome == 'failure'
226
+ uses : slackapi/slack-github-action@fcfb566f8b0aab22203f066d80ca1d7e4b5d05b3 # v1.27.1
227
+ with :
228
+ channel-id : ${{ secrets.ALERTS_SLACK_CHANNEL_ID }}
229
+ payload : |
230
+ {
231
+ "blocks": [
232
+ {
233
+ "type": "section",
234
+ "text": {
235
+ "type": "mrkdwn",
236
+ "text": ":warning: *CDN Publish Failed* :warning:\nThe CDN publishing step has failed for new package versions."
237
+ }
238
+ },
239
+ {
240
+ "type": "context",
241
+ "elements": [
242
+ {
243
+ "type": "mrkdwn",
244
+ "text": "*Workflow:* `${{ github.workflow }}`"
245
+ }
246
+ ]
247
+ },
248
+ {
249
+ "type": "actions",
250
+ "elements": [
251
+ {
252
+ "type": "button",
253
+ "text": {
254
+ "type": "plain_text",
255
+ "text": "View Workflow Run :github:",
256
+ "emoji": true
257
+ },
258
+ "url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
259
+ "style": "primary"
260
+ },
261
+ {
262
+ "type": "button",
263
+ "text": {
264
+ "type": "plain_text",
265
+ "text": "View Repository :octocat:",
266
+ "emoji": true
267
+ },
268
+ "url": "https://github.com/${{ github.repository }}",
269
+ "style": "primary"
270
+ }
271
+ ]
272
+ }
273
+ ]
274
+ }
275
+ env :
276
+ SLACK_BOT_TOKEN : ${{ secrets.SLACK_BOT_TOKEN }}
277
+
278
+
0 commit comments