-
Notifications
You must be signed in to change notification settings - Fork 6
196 lines (166 loc) · 6.97 KB
/
external-healthcheck.yml
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
name: External healthcheck
run-name: External healthcheck - ${{ inputs.branch }} @ ${{ inputs.owner }}/${{ inputs.repo }}
concurrency:
group: ${{ github.workflow }}-${{ inputs.branch }}-${{ inputs.owner }}-${{ inputs.repo }}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
owner:
description: "Owner to checkout"
required: true
type: string
repo:
description: "Repo to checkout"
required: true
type: string
branch:
description: "Branch to checkout"
required: true
type: string
sha:
description: "Commit to checkout"
required: true
type: string
check:
description: "Check ID"
required: true
type: number
jobs:
trigger-build:
runs-on: ubuntu-latest
outputs:
success: ${{ steps.status.outputs.success }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Print inputs
run: |
echo "branch" ${{ inputs.branch }}
echo "repo" ${{ inputs.repo }}
echo "sha" ${{ inputs.sha }}
ORG=${{ inputs.owner }}
BRANCH=${{ inputs.branch }}
BRANCH=$(printf '%s' "$BRANCH" | sed 's/\//\\\//g')
if [[ "${{ inputs.repo }}" == "frontends" ]]; then
echo "Embedding frontends"
sed -i "0,/ORG_FRONTENDS.*/s/.*ORG_FRONTENDS.*/ORG_FRONTENDS=$ORG/" ./.github/scripts/embed.sh
sed -i "0,/BRANCH_FRONTENDS.*/s/.*BRANCH_FRONTENDS.*/BRANCH_FRONTENDS=$BRANCH/" ./.github/scripts/embed.sh
elif [[ "${{ inputs.repo }}" == "admin-extension-sdk" ]]; then
echo "Embedding admin-extension-sdk"
sed -i "0,/ORG_ADMIN_EXTENSION_SDK.*/s/.*ORG_ADMIN_EXTENSION_SDK.*/ORG_ADMIN_EXTENSION_SDK=$ORG/" ./.github/scripts/embed.sh
sed -i "0,/BRANCH_ADMIN_EXTENSION_SDK.*/s/.*BRANCH_ADMIN_EXTENSION_SDK.*/BRANCH_ADMIN_EXTENSION_SDK=$BRANCH/" ./.github/scripts/embed.sh
elif [[ "${{ inputs.repo }}" == "meteor-icon-kit" ]]; then
echo "Embedding meteor-icon-kit"
sed -i "0,/ORG_METEOR_ICON_KIT.*/s/.*ORG_METEOR_ICON_KIT.*/ORG_METEOR_ICON_KIT=$ORG/" ./.github/scripts/embed.sh
sed -i "0,/BRANCH_METEOR_ICON_KIT.*/s/.*BRANCH_METEOR_ICON_KIT.*/BRANCH_METEOR_ICON_KIT=$BRANCH/" ./.github/scripts/embed.sh
elif [[ "${{ inputs.repo }}" == "meteor-component-library" ]]; then
echo "Embedding meteor-component-library"
sed -i "0,/ORG_METEOR_COMPONENT_LIBRARY.*/s/.*ORG_METEOR_COMPONENT_LIBRARY.*/ORG_METEOR_COMPONENT_LIBRARY=$ORG/" ./.github/scripts/embed.sh
sed -i "0,/BRANCH_METEOR_COMPONENT_LIBRARY.*/s/.*BRANCH_METEOR_COMPONENT_LIBRARY.*/BRANCH_METEOR_COMPONENT_LIBRARY=$BRANCH/" ./.github/scripts/embed.sh
elif [[ "${{ inputs.repo }}" == "docs" ]]; then
echo "Embedding docs"
sed -i "0,/ORG_DOCS.*/s/.*ORG_DOCS.*/ORG_DOCS=$ORG/" ./.github/scripts/embed.sh
sed -i "0,/BRANCH_DOCS.*/s/.*BRANCH_DOCS.*/BRANCH_DOCS=$BRANCH/" ./.github/scripts/embed.sh
elif [[ "${{ inputs.repo }}" == "release-notes" ]]; then
echo "Embedding release-notes"
sed -i "0,/ORG_RELEASE_NOTES.*/s/.*ORG_RELEASE_NOTES.*/ORG_RELEASE_NOTES=$ORG/" ./.github/scripts/embed.sh
sed -i "0,/BRANCH_RELEASE_NOTES.*/s/.*BRANCH_RELEASE_NOTES.*/BRANCH_RELEASE_NOTES=$BRANCH/" ./.github/scripts/embed.sh
else
echo "Unknown repository ${{inputs.repo}}"
echo "Branch ${{inputs.branch}}"
exit 1
fi
cat ./.github/scripts/embed.sh
- name: Prepare
uses: ./.github/actions/checkout-install
with:
apt: true
- name: Embed repos
env:
GITLAB_FRONTENDS_USERNAME: ${{ secrets.GITLAB_FRONTENDS_USERNAME }}
GITLAB_FRONTENDS_ACCESS_KEY: ${{ secrets.GITLAB_FRONTENDS_ACCESS_KEY }}
FIGMA_TOKEN: ${{ secrets.FIGMA_TOKEN }}
FIGMA_FILE: ${{ secrets.FIGMA_FILE }}
run: |
chmod +x ./.github/scripts/embed.sh
.github/scripts/embed.sh
- name: Test dev
run: |
export NODE_OPTIONS="--max-old-space-size=8096"
pnpm run test || echo "DEV TEST FAILED"
- name: Build
run: |
export NODE_OPTIONS="--max-old-space-size=8096"
export USERCENTRICS="65ynhGFvE"
pnpm run build
- name: Zip folder
run: zip -r full-build.zip .vitepress/dist/ vercel.json
- name: Upload build
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: full-build-${{ github.sha }}
path: full-build.zip
- name: Test build
run: |
export NODE_OPTIONS="--max-old-space-size=8096"
pnpm run test:build
- name: Mark as successful
id: status
run: |
echo "success=yes" >> "$GITHUB_OUTPUT"
deploy-vercel:
name: Deploy to Vercel
runs-on: ubuntu-latest
timeout-minutes: 15
needs:
- trigger-build
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: full-build-${{ github.sha }}
- name: Unzip artifact
run: |
mkdir -p .vitepress/dist
unzip -o full-build.zip
ls -la .vitepress/dist
- name: Install Vercel CLI
run: npm install -g vercel@latest
- name: Pull Vercel Environment Information
run: |
VERCEL_ENV="preview"
VERCEL_ENV_FLAG=""
vercel pull --yes --environment=$VERCEL_ENV --token=${{ secrets.VERCEL_TOKEN }} --scope=${{ secrets.VERCEL_ORG_ID }}
vercel build ./.vitepress/dist --token=${{ secrets.VERCEL_TOKEN }} $VERCEL_ENV_FLAG
vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} $VERCEL_ENV_FLAG > ./vercel.env
update-healthcheck-success:
name: Test build
runs-on: ubuntu-latest
needs:
- trigger-build
- deploy-vercel
if: ${{ always() }}
steps:
- uses: octokit/[email protected]
name: Update check
with:
route: POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches
owner: ${{ inputs.owner }}
repo: ${{ inputs.repo }}
ref: main
workflow_id: update-healthcheck.yml
inputs: |
owner: ${{ inputs.owner }}
repo: ${{ inputs.repo }}
check: "${{ inputs.check }}"
conclusion: ${{ needs.trigger-build.outputs.success && needs.trigger-build.outputs.success == 'yes' && 'success' || 'failure' }}
run_id: "${{ github.run_id }}"
env:
GITHUB_TOKEN: ${{ secrets.DEV_HUB_PERSONAL_ACCESS_TOKEN }}