-
Notifications
You must be signed in to change notification settings - Fork 28
128 lines (111 loc) · 4.16 KB
/
checks.yaml
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
name: Check PR
on:
pull_request:
types: [opened, reopened, synchronize, labeled]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare
uses: ./.github/actions/prepare
- name: Checking Conventional Commits
run: node ./scripts/check-conventional-commits/command.mjs
env:
REF: ${{ github.ref }}
- name: Extract new translations to check if any error exists
run: node ./scripts/lingui/command.js extract --clean
- name: Test
run: |
node ./scripts/build-libs/command.mjs
yarn run test
#In the test step, we build all packages, and the build meta files are generated.
#Therefore, this step should be executed after the test step.
- id: upload_artifacts
name: Upload Build Artifacts
uses: ./.github/actions/upload-build-artifacts
# for preview deployment for specific project, add vercel project id in environment section
- name: Preview Deployment
id: deploy
run: |
yarn global add vercel
yarn run deploy
env:
REF: ${{ github.ref }}
GH_TOKEN: ${{ github.token }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_PROJECT_WIDGET_CONFIG: ${{ secrets.VERCEL_PROJECT_WIDGET_CONFIG }} # widget playground
VERCEL_PROJECT_WIDGET_APP: ${{ secrets.VERCEL_PROJECT_WIDGET_APP }} # widget app
VERCEL_PROJECT_STORYBOOK: ${{ secrets.VERCEL_PROJECT_STORYBOOK }} # storybook
ENABLE_PREVIEW_DEPLOY: true
outputs:
# the structure of output variable is {packageNameWithoutScope}-url like: widget-app-url
app_url: ${{ steps.deploy.outputs.widget-app-url }}
playground_url: ${{ steps.deploy.outputs.widget-playground-url }}
storybook_url: ${{ steps.deploy.outputs.storybook-url }}
# add job for each project that you want has preview deployment
app-preview:
runs-on: ubuntu-latest
needs: check
environment:
name: app-preview
url: ${{ steps.seturl.outputs.url }}
steps:
- name: Extract Preview URL
id: seturl
run: |
echo "url=${{ needs.check.outputs.app_url }}">> $GITHUB_OUTPUT
echo "Preview URL: ${{ needs.check.outputs.app_url}}"
playground-preview:
runs-on: ubuntu-latest
needs: check
environment:
name: playground-preview
url: ${{ steps.seturl.outputs.url }}
steps:
- name: Extract Preview URL
id: seturl
run: |
echo "url=${{ needs.check.outputs.playground_url }}">> $GITHUB_OUTPUT
echo "Preview URL: ${{ needs.check.outputs.playground_url}}"
storybook-preview:
runs-on: ubuntu-latest
needs: check
environment:
name: storybook-preview
url: ${{ steps.seturl.outputs.url }}
steps:
- name: Extract Preview URL
id: seturl
run: |
echo "url=${{ needs.check.outputs.storybook_url }}">> $GITHUB_OUTPUT
echo "Preview URL: ${{ needs.check.outputs.storybook_url}}"
analyze-bundle:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Prepare
uses: ./.github/actions/prepare
- name: Download Build Information For Current Branch
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: ${{steps.upload_artifacts.outputs.hashed}}
path: 'current-branch'
- name: Hash Target Branch Name
id: hash_target_branch_name
run: |
hashed_name=$(printf "%s" "${{ github.base_ref }}" | base64 -w 0)
echo "hashed=${hashed_name}">> $GITHUB_OUTPUT
- name: Analyze Bundles And Create Report
run: node ./scripts/analyze-bundle/command.mjs --currentBranchDirectory current-branch --targetBranchDirectory target-branch --targetBranchArtifactName ${{steps.hash_target_branch_name.outputs.hashed}}
env:
GH_TOKEN: ${{ github.token }}
GH_REPOSITORY: ${{ github.repository }}