-
Notifications
You must be signed in to change notification settings - Fork 8
327 lines (284 loc) · 12.4 KB
/
shipit_master_and_example_apps_deployment.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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
name: Deploy Stencil Web components Library to NPM
on:
push:
branches:
- master
jobs:
stencil-library-release:
outputs:
VERSION: ${{ steps.build.outputs.VERSION }}
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')" # job will not run, if triggered via ship-it
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all tags for ship-it
- name: download + setup auto
uses: auto-it/setup-auto@v1
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
with:
path: |
~/.npm
**/node_modules
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/lerna.json') }}
restore-keys: |
${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}-
${{ runner.os }}-build-
- name: Install dependencies for all packages
run: npm install
- name: Build and deploy Stencil core package
id: build
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm run build:components
cd packages/components
VERSION=$(auto shipit --dry-run --quiet)
echo "Publishing: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Set version as Github Env and Github Output: $VERSION"
echo "WEBEX_MESSAGE=New package release - Version: $VERSION" >> $GITHUB_ENV
auto shipit
- name: Sleep for 10 seconds #needed because we had runtime issues where the wrappers are not getting the newest version
run: sleep 10s
shell: bash
- name: Update Dependencies in Angular, Vue and React packages
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "VERSION: $VERSION"
echo "Installing Stencil library for Angular, Vue and React: $VERSION"
lerna version $VERSION --no-git-tag-version --y
# Update Angular package
cd packages/components-angular/projects/component-library
jq --arg VERSION "$VERSION" '.peerDependencies["@infineon/infineon-design-system-stencil"] = $VERSION' package.json > package.json.tmp && mv package.json.tmp package.json
cd ../../../../
# Update Vue package
cd packages/components-vue
jq --arg VERSION "$VERSION" '.dependencies["@infineon/infineon-design-system-stencil"] = $VERSION' package.json > package.json.tmp && mv package.json.tmp package.json
# Update React package
cd ../components-react
jq --arg VERSION "$VERSION" '.dependencies["@infineon/infineon-design-system-stencil"] = $VERSION | sub("^"; "")' package.json > package.json.tmp && mv package.json.tmp package.json
# Check if package-lock.json exists and update it
if [ -f package-lock.json ]; then
jq --arg VERSION "$VERSION" '.dependencies["@infineon/infineon-design-system-stencil"] = $VERSION' package-lock.json > package-lock.json.tmp && mv package-lock.json.tmp package-lock.json
else
npm install
fi
cd ../../
npm ci
# Verify updates
echo "Verifying updates in Angular package"
jq '.peerDependencies["@infineon/infineon-design-system-stencil"]' packages/components-angular/projects/component-library/package.json
echo "Verifying updates in Vue package"
jq '.dependencies["@infineon/infineon-design-system-stencil"]' packages/components-vue/package.json
echo "Verifying updates in React package"
jq '.dependencies["@infineon/infineon-design-system-stencil"]' packages/components-react/package.json
- name: Build and deploy Angular, Vue and React packages
id: build-and-deploy-wrappers
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
lerna version $VERSION --no-git-tag-version --y
npm run build:components-angular
npm run build:components-react
npm run build:components-vue
cd packages/components-angular/dist/@infineon/infineon-design-system-angular
npm publish --verbose
cd ../../../../components-react
npm publish
cd ../components-vue
npm publish
- name: Sleep for 10 seconds #needed because we had runtime issues where the wrappers are not getting the newest version
run: |
echo "Skip Remaining: ${{ steps.build.outputs.SKIP_REMAINING }}"
sleep 10s
shell: bash
- name: Update Dependencies in example applications
if: steps.build.outputs.SKIP_REMAINING == 'false'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
VERSION: ${{ steps.build.outputs.VERSION }}
run: |
# Update Vue wrapper component
cd examples/wrapper-components/vue-javascript
jq --arg VERSION "$VERSION" '.dependencies["@infineon/infineon-design-system-vue"] = $VERSION' package.json > package.json.tmp && mv package.json.tmp package.json
cd ../../..
# Update React wrapper component
cd examples/wrapper-components/react-vite-js
jq --arg VERSION "$VERSION" '.dependencies["@infineon/infineon-design-system-react"] = $VERSION' package.json > package.json.tmp && mv package.json.tmp package.json
cd ../../..
- name: Commit and push all changes
if: steps.build.outputs.SKIP_REMAINING == 'false'
env:
BRANCH_NAME: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
git add .
git commit -m "Update Stencil library version to $VERSION"
git push origin HEAD:master
#deploy gh-pages for example applications based on the master branch:
deploy-master-vue:
needs: stencil-library-release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install and Build
run: |
cd examples/wrapper-components/vue-javascript
npm i
npm run build
- name: Deploy Vue Example🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: examples/wrapper-components/vue-javascript/dist/ # The folder the action should deploy.
target-folder: vue-example
clean-exclude: |
angular-example/
react-example/
vanilla-example/
pr-preview/
pr-preview-vue-example/
pr-preview-react-example/
pr-preview-angular-example/
pr-preview-vanilla-example/
force: false
deploy-master-react:
needs: stencil-library-release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install and Build
run: |
cd examples/wrapper-components/react-vite-js
REACT_VERSION=$(jq -r '.dependencies["@infineon/infineon-design-system-react"]' package.json)
STENCIL_VERSION=$(npm list @infineon/infineon-design-system-stencil --depth=1 | grep @infineon/infineon-design-system-stencil@ | awk -F@ '{print $3}')
npm install
echo "Installed version Stencil: $STENCIL_VERSION - Installed version React: $REACT_VERSION"
npm run build
- name: Deploy React Example🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: examples/wrapper-components/react-vite-js/dist # The folder the action should deploy.
target-folder: react-example
clean-exclude: |
angular-example/
vanilla-example/
vue-example/
pr-preview/
pr-preview-vue-example/
pr-preview-react-example/
pr-preview-angular-example/
pr-preview-vanilla-example/
force: false
deploy-master-angular:
needs: stencil-library-release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Update package.json with version
run: |
cd packages/components-angular
jq --arg VERSION "${{ needs.stencil-library-release.outputs.VERSION }}" '.dependencies["@infineon/infineon-design-system-angular"] = $VERSION' package.json > package.json.tmp && mv package.json.tmp package.json
cd projects/component-library
jq --arg VERSION "${{ needs.stencil-library-release.outputs.VERSION }}" '.peerDependencies["@infineon/infineon-design-system-stencil"] = $VERSION' package.json > package.json.tmp && mv package.json.tmp package.json
- name: Install and Build
run: |
cd packages/components-angular
npm i
npm run build my-app
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: packages/components-angular/dist/my-app/ # The folder the action should deploy.
target-folder: angular-example
clean-exclude: |
react-example/
vanilla-example/
vue-example/
pr-preview/
pr-preview-vue-example/
pr-preview-react-example/
pr-preview-angular-example/
pr-preview-vanilla-example/
force: false
deploy-master-vanilla:
needs: stencil-library-release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Update CDN Link in Vanilla example app & build
run: |
cd examples/stencil-components/vanilla-cdn
npm install
npm run update-link
npm run build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: examples/stencil-components/vanilla-cdn/dist # The folder the action should deploy.
target-folder: vanilla-example
clean-exclude: |
angular-example/
react-example/
vue-example/
pr-preview/
pr-preview-vue-example/
pr-preview-react-example/
pr-preview-angular-example/
pr-preview-vanilla-example/
force: false
send-webex-notification:
needs: [stencil-library-release, deploy-master-vue, deploy-master-react, deploy-master-angular, deploy-master-vanilla]
runs-on: ubuntu-latest
steps:
- name: Send Webex Notification
run: |
VERSION=${{ needs.stencil-library-release.outputs.VERSION }}
WEBEX_MESSAGE="**VERSION UPDATE**\nA new version has been released: [$VERSION](https://github.com/Infineon/infineon-design-system-stencil/releases/tag/v$VERSION)\nFollow the link to see what's included in this release."
curl https://webexapis.com/v1/messages -X POST -H "Authorization: Bearer ${{ secrets.WEBEX_TOKEN }}" -H "Content-Type: application/json" -d "{\"roomId\":\"${{ secrets.WEBEX_ROOM_ID }}\",\"markdown\":\"$WEBEX_MESSAGE\"}"
shell: bash