Skip to content

Commit 596b892

Browse files
authored
ci(pack): enable ecosystem CI (#3294)
* ci(pack): enable ecosystem CI * ci(pack): run ecosystem checks after publish
1 parent 4d26dee commit 596b892

2 files changed

Lines changed: 98 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: utoopack-ecosystem
2+
3+
on:
4+
push:
5+
branches: ["next"]
6+
pull_request:
7+
branches: ["next"]
8+
types: [opened, synchronize, reopened, edited]
9+
workflow_dispatch:
10+
inputs:
11+
suite:
12+
description: Ecosystem suite
13+
required: true
14+
type: choice
15+
options:
16+
- all
17+
- umi
18+
- ant-design-pro
19+
- father
20+
- dumi
21+
- evjs
22+
default: all
23+
24+
permissions:
25+
contents: read
26+
27+
jobs:
28+
ecosystem:
29+
if: >-
30+
github.event_name == 'workflow_dispatch' ||
31+
(github.event_name == 'push' && contains(github.event.head_commit.message, '(pack)')) ||
32+
(github.event_name == 'pull_request' && contains(github.event.pull_request.title, '(pack)'))
33+
uses: utooland/utoo-ecosystem-ci/.github/workflows/ecosystem-ci.yml@main
34+
with:
35+
candidate_mode: source
36+
utoo_repository: >-
37+
${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
38+
utoo_ref: >-
39+
${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
40+
suite: >-
41+
${{ github.event_name == 'workflow_dispatch' && inputs.suite || 'all' }}
42+
harness_repository: utooland/utoo-ecosystem-ci
43+
harness_ref: main

‎.github/workflows/pack-release.yml‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ jobs:
269269
id-token: write
270270
needs:
271271
- build
272+
outputs:
273+
version: ${{ steps.get_version.outputs.VERSION }}
272274
steps:
273275
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
274276
with:
@@ -334,3 +336,56 @@ jobs:
334336
npm publish --workspace=@utoo/pack-cli --access public --tag "${TAG}"
335337
env:
336338
VERSION: ${{ steps.get_version.outputs.VERSION }}
339+
340+
ecosystem:
341+
name: Ecosystem CI
342+
needs:
343+
- publish
344+
permissions:
345+
contents: read
346+
uses: utooland/utoo-ecosystem-ci/.github/workflows/ecosystem-ci.yml@main
347+
with:
348+
candidate_mode: npm
349+
pack_spec: ${{ needs.publish.outputs.version }}
350+
suite: all
351+
harness_repository: utooland/utoo-ecosystem-ci
352+
harness_ref: main
353+
354+
notify_ecosystem_failure:
355+
name: Notify ecosystem failure
356+
if: >-
357+
always() &&
358+
needs.publish.result == 'success' &&
359+
needs.ecosystem.result == 'failure'
360+
needs:
361+
- publish
362+
- ecosystem
363+
runs-on: ubuntu-latest
364+
permissions:
365+
issues: write
366+
steps:
367+
- name: Create failure issue
368+
shell: bash
369+
env:
370+
GH_TOKEN: ${{ github.token }}
371+
VERSION: ${{ needs.publish.outputs.version }}
372+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
373+
TAG_URL: ${{ github.server_url }}/${{ github.repository }}/tree/${{ github.ref_name }}
374+
run: |
375+
set -euo pipefail
376+
377+
title="ci(pack): ecosystem CI failed for @utoo/pack@${VERSION}"
378+
body_path="${RUNNER_TEMP}/ecosystem-failure.md"
379+
printf '%s\n' \
380+
"The post-publish ecosystem CI failed for @utoo/pack@${VERSION}." \
381+
"" \
382+
"- Release tag: [${GITHUB_REF_NAME}](${TAG_URL})" \
383+
"- Workflow run: [${GITHUB_RUN_ID}](${RUN_URL})" \
384+
"" \
385+
"This issue was created automatically after consumer validation failed." \
386+
> "${body_path}"
387+
388+
gh issue create \
389+
--repo "${GITHUB_REPOSITORY}" \
390+
--title "${title}" \
391+
--body-file "${body_path}"

0 commit comments

Comments
 (0)