-
Notifications
You must be signed in to change notification settings - Fork 395
167 lines (150 loc) · 5.88 KB
/
Copy pathcomponent-ci-call.yml
File metadata and controls
167 lines (150 loc) · 5.88 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
name: component-ci-call
permissions:
contents: read
pull-requests: write
on:
workflow_run:
workflows:
- component-ci
types:
- completed
jobs:
call-context:
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request'
runs-on: ubuntu-latest
outputs:
pr_id: ${{ steps.pr.outputs.id }}
report: ${{ steps.pr.outputs.report }}
tdesign_vue_domain: ${{ steps.site-domain.outputs.tdesign_vue_domain }}
tdesign_react_domain: ${{ steps.site-domain.outputs.tdesign_react_domain }}
tdesign_vue_next_domain: ${{ steps.site-domain.outputs.tdesign_vue_next_domain }}
tdesign_mobile_vue_domain: ${{ steps.site-domain.outputs.tdesign_mobile_vue_domain }}
tdesign_mobile_react_domain: ${{ steps.site-domain.outputs.tdesign_mobile_react_domain }}
steps:
- name: Download pr id
uses: dawidd6/action-download-artifact@v21
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
run_id: ${{ github.event.workflow_run.id }}
name: pr-id
- name: Download pr report
uses: dawidd6/action-download-artifact@v21
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
run_id: ${{ github.event.workflow_run.id }}
name: report
- name: Set pr info
id: pr
run: |
PR_ID=$(cat pr-id.txt)
if [[ ! "$PR_ID" =~ ^[0-9]+$ ]]; then
echo "::error::Invalid PR ID: $PR_ID"
exit 1
fi
echo "id=$PR_ID" >> $GITHUB_OUTPUT
{
echo 'report<<EOF'
cat report.txt
echo 'EOF'
} >> $GITHUB_OUTPUT
- name: site-domain
id: site-domain
run: |
echo "tdesign_vue_domain=https://preview-tdesign-vue-pr-${{ steps.pr.outputs.id }}-tdesign-common.surge.sh" >> $GITHUB_OUTPUT
echo "tdesign_react_domain=https://preview-tdesign-react-pr-${{ steps.pr.outputs.id }}-tdesign-common.surge.sh" >> $GITHUB_OUTPUT
echo "tdesign_vue_next_domain=https://preview-tdesign-vue-next-pr-${{ steps.pr.outputs.id }}-tdesign-common.surge.sh" >> $GITHUB_OUTPUT
echo "tdesign_mobile_vue_domain=https://preview-tdesign-mobile-vue-pr-${{ steps.pr.outputs.id }}-tdesign-common.surge.sh" >> $GITHUB_OUTPUT
echo "tdesign_mobile_react_domain=https://preview-tdesign-mobile-react-pr-${{ steps.pr.outputs.id }}-tdesign-common.surge.sh" >> $GITHUB_OUTPUT
tdesign-vue:
if: github.event.workflow_run.conclusion == 'success'
needs: call-context
runs-on: ubuntu-latest
steps:
- uses: dawidd6/action-download-artifact@v21
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
run_id: ${{ github.event.workflow_run.id }}
name: tdesign-vue-site
- uses: TDesignOteam/workflows/actions/setup-surge@main
with:
token: ${{ secrets.TDESIGN_SURGE_TOKEN }}
project: ./
domain: ${{ needs.call-context.outputs.tdesign_vue_domain }}
tdesign-react:
if: github.event.workflow_run.conclusion == 'success'
needs: call-context
runs-on: ubuntu-latest
steps:
- uses: dawidd6/action-download-artifact@v21
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
run_id: ${{ github.event.workflow_run.id }}
name: tdesign-react-site
- uses: TDesignOteam/workflows/actions/setup-surge@main
with:
token: ${{ secrets.TDESIGN_SURGE_TOKEN }}
project: ./
domain: ${{ needs.call-context.outputs.tdesign_react_domain }}
tdesign-vue-next:
if: github.event.workflow_run.conclusion == 'success'
needs: call-context
runs-on: ubuntu-latest
steps:
- uses: dawidd6/action-download-artifact@v21
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
run_id: ${{ github.event.workflow_run.id }}
name: tdesign-vue-next-site
- uses: TDesignOteam/workflows/actions/setup-surge@main
with:
token: ${{ secrets.TDESIGN_SURGE_TOKEN }}
project: ./
domain: ${{ needs.call-context.outputs.tdesign_vue_next_domain }}
tdesign-mobile-vue:
if: github.event.workflow_run.conclusion == 'success'
needs: call-context
runs-on: ubuntu-latest
steps:
- uses: dawidd6/action-download-artifact@v21
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
run_id: ${{ github.event.workflow_run.id }}
name: tdesign-mobile-vue-site
- uses: TDesignOteam/workflows/actions/setup-surge@main
with:
token: ${{ secrets.TDESIGN_SURGE_TOKEN }}
project: ./
domain: ${{ needs.call-context.outputs.tdesign_mobile_vue_domain }}
tdesign-mobile-react:
if: github.event.workflow_run.conclusion == 'success'
needs: call-context
runs-on: ubuntu-latest
steps:
- uses: dawidd6/action-download-artifact@v21
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
run_id: ${{ github.event.workflow_run.id }}
name: tdesign-mobile-react-site
- uses: TDesignOteam/workflows/actions/setup-surge@main
with:
token: ${{ secrets.TDESIGN_SURGE_TOKEN }}
project: ./
domain: ${{ needs.call-context.outputs.tdesign_mobile_react_domain }}
report-comment:
if: always()
needs:
- call-context
- tdesign-vue
- tdesign-react
- tdesign-mobile-vue
- tdesign-mobile-react
- tdesign-vue-next
runs-on: ubuntu-latest
steps:
- name: comment
uses: TDesignOteam/workflows/actions/maintain-one-comment@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
number: '${{ needs.call-context.outputs.pr_id }}'
body: ${{ needs.call-context.outputs.report }}
body-include: '<!-- AUTO_REPORT_HOOK -->'