Skip to content

Commit c96d122

Browse files
authored
Merge pull request #2083 from Infineon/1661-hotfix
ci: mirro master and pr workflows
2 parents 0220346 + 9a01ede commit c96d122

File tree

11 files changed

+16176
-14225
lines changed

11 files changed

+16176
-14225
lines changed

.github/workflows/shipit_master_and_example_apps_deployment.yml

Lines changed: 117 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,23 @@ on:
55
branches:
66
- master
77

8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
813
jobs:
914
stencil-library-release:
1015
outputs:
1116
VERSION: ${{ steps.build.outputs.VERSION }}
17+
SKIP_REMAINING: ${{ steps.build.outputs.SKIP_REMAINING }}
1218
runs-on: ubuntu-latest
1319
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
1420
steps:
1521
- name: checkout
1622
uses: actions/checkout@v4
1723
with:
24+
ref: ${{ github.ref }}
1825
fetch-depth: 0 # fetch all tags for ship-it
1926

2027
- name: download + setup auto
@@ -25,20 +32,42 @@ jobs:
2532
with:
2633
node-version: 20
2734
registry-url: "https://registry.npmjs.org"
28-
35+
cache: 'npm'
2936

3037
- name: Install jq
31-
run: sudo apt-get update && sudo apt-get install -y jq
38+
run: |
39+
if command -v jq &> /dev/null; then
40+
echo "✅ jq is already installed: $(jq --version)"
41+
else
42+
echo "📦 Installing jq..."
43+
sudo apt-get update && sudo apt-get install -y jq
44+
fi
45+
46+
- name: Cache node modules
47+
id: cache-npm
48+
uses: actions/cache@v3
49+
with:
50+
path: |
51+
~/.npm
52+
**/node_modules
53+
54+
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/lerna.json') }}
55+
restore-keys: |
56+
${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}-
57+
${{ runner.os }}-build-
3258
59+
3360
- name: Install dependencies for all packages
3461
run: |
3562
npm ci
3663
64+
3765
- name: Run tests
3866
run: |
3967
cd packages/components
4068
npm test
4169
70+
4271
- name: Build and deploy Stencil core package
4372
id: build
4473
env:
@@ -47,79 +76,95 @@ jobs:
4776
npm run build:components
4877
cd packages/components
4978
VERSION=$(auto shipit --dry-run --quiet)
50-
echo "Publishing: $VERSION"
5179
echo "VERSION=$VERSION" >> $GITHUB_ENV
5280
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
53-
echo "Set version as Github Env and Github Output: $VERSION"
81+
echo "SKIP_REMAINING=false" >> $GITHUB_OUTPUT
5482
echo "WEBEX_MESSAGE=New package release - Version: $VERSION" >> $GITHUB_ENV
83+
echo "Publishing: $VERSION"
5584
auto shipit
5685
5786
- name: Check package availability
87+
if: steps.build.outputs.SKIP_REMAINING == 'false'
5888
uses: ./.github/actions/check-package-availability
5989
with:
6090
package: "@infineon/infineon-design-system-stencil"
6191
version: ${{ steps.build.outputs.VERSION }}
6292
max-attempts: 10
6393
max-delay: 20
64-
94+
6595
- name: Update Dependencies in Angular, Vue and React packages
96+
if: steps.build.outputs.SKIP_REMAINING == 'false'
97+
id: update-wrapper-dependencies
6698
env:
6799
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
68-
run: |
100+
BRANCH_NAME: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
101+
VERSION: ${{ steps.build.outputs.VERSION }}
102+
103+
run: |
69104
echo "VERSION: $VERSION"
70105
echo "Installing Stencil library for Angular, Vue and React: $VERSION"
71106
lerna version $VERSION --no-git-tag-version --y
72-
107+
73108
# Update Angular package
74109
cd packages/components-angular/projects/component-library
75-
jq --arg VERSION "$VERSION" '.peerDependencies["@infineon/infineon-design-system-stencil"] = $VERSION' package.json > package.json.tmp && mv package.json.tmp package.json
110+
jq 'del(.dependencies["@infineon/infineon-design-system-stencil"])' package.json > tmp && mv tmp package.json
111+
jq --arg VERSION "$VERSION" '.dependencies["@infineon/infineon-design-system-stencil"] = $VERSION' package.json > tmp && mv tmp package.json
76112
cd ../../../../
77113
78114
# Update Vue package
79115
cd packages/components-vue
80-
jq --arg VERSION "$VERSION" '.dependencies["@infineon/infineon-design-system-stencil"] = $VERSION' package.json > package.json.tmp && mv package.json.tmp package.json
81-
116+
VERSION_CLEAN=$(echo "$VERSION" | sed 's/^[\^~]*//') # strip any leading ^ or ~ just in case
117+
jq 'del(.dependencies["@infineon/infineon-design-system-stencil"])' package.json > tmp && mv tmp package.json
118+
jq --arg v "$VERSION_CLEAN" '.dependencies["@infineon/infineon-design-system-stencil"] = $v' package.json > tmp && mv tmp package.json
119+
82120
# Update React package
83121
cd ../components-react
84-
jq --arg VERSION "$VERSION" '.dependencies["@infineon/infineon-design-system-stencil"] = $VERSION | sub("^"; "")' package.json > package.json.tmp && mv package.json.tmp package.json
85-
86-
# Check if package-lock.json exists and update it
87-
if [ -f package-lock.json ]; then
88-
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
89-
else
90-
npm install
91-
fi
122+
jq 'del(.dependencies["@infineon/infineon-design-system-stencil"])' package.json > tmp && mv tmp package.json
123+
jq --arg VERSION "$VERSION" '.dependencies["@infineon/infineon-design-system-stencil"] = $VERSION' package.json > tmp && mv tmp package.json
92124

93-
cd ../../
125+
# Retry install of published Stencil package (race condition safe)
126+
RETRIES=5
127+
for i in $(seq 1 $RETRIES); do
128+
echo "Attempt $i to install Stencil version: $VERSION"
129+
if npm install "@infineon/infineon-design-system-stencil@$VERSION" --save-exact; then
130+
echo "✅ Installed successfully on attempt $i"
131+
break
132+
else
133+
echo "❌ Failed, retrying in $((i * 5)) seconds..."
134+
sleep $((i * 5))
135+
fi
136+
done
94137

95-
npm ci
138+
cd ../../
139+
npm install
96140

97141
# Verify updates
98142
echo "Verifying updates in Angular package"
99-
jq '.peerDependencies["@infineon/infineon-design-system-stencil"]' packages/components-angular/projects/component-library/package.json
143+
jq '.dependencies["@infineon/infineon-design-system-stencil"]' packages/components-angular/projects/component-library/package.json
100144
echo "Verifying updates in Vue package"
101145
jq '.dependencies["@infineon/infineon-design-system-stencil"]' packages/components-vue/package.json
102146
echo "Verifying updates in React package"
103147
jq '.dependencies["@infineon/infineon-design-system-stencil"]' packages/components-react/package.json
104148

149+
105150
- name: Build and deploy Angular, Vue and React packages
106-
id: build-and-deploy-wrappers
151+
if: steps.build.outputs.SKIP_REMAINING == 'false'
107152
env:
108153
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
109-
run: |
154+
run: |
110155
lerna version $VERSION --no-git-tag-version --y
111156
npm run build:components-angular
112157
npm run build:components-react
113-
npm run build:components-vue
158+
npm run build:components-vue
114159
cd packages/components-angular/dist/@infineon/infineon-design-system-angular
115-
npm publish --verbose
160+
npm publish
116161
cd ../../../../components-react
117162
npm publish
118163
cd ../components-vue
119-
npm publish
120-
164+
npm publish
121165
122166
- name: Update Dependencies in example applications
167+
if: steps.build.outputs.SKIP_REMAINING == 'false'
123168
env:
124169
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
125170
VERSION: ${{ steps.build.outputs.VERSION }}
@@ -135,36 +180,40 @@ jobs:
135180
cd ../../..
136181

137182
- name: Commit and push all changes
183+
if: steps.build.outputs.SKIP_REMAINING == 'false'
138184
env:
139185
BRANCH_NAME: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
140186
run: |
141187
git config user.name "github-actions"
142188
git config user.email "github-actions@github.com"
143189
git add .
144190
git commit -m "Update Stencil library version to $VERSION"
145-
git push origin HEAD:master
191+
git push origin HEAD:$BRANCH_NAME
146192
147-
#deploy gh-pages for example applications based on the master branch:
148-
deploy-master-vue:
193+
#deploy gh-pages previews for example applications:
194+
deploy-preview-vue:
149195
needs: stencil-library-release
196+
if: needs.stencil-library-release.outputs.SKIP_REMAINING == 'false'
150197
runs-on: ubuntu-latest
198+
outputs:
199+
deployment-url: ${{ steps.preview.outputs.deployment-url }}
151200
steps:
152201
- name: Checkout
153202
uses: actions/checkout@v4
154-
155-
- name: Use Node.js 20
203+
204+
- name: Use Node.js 20.x
156205
uses: actions/setup-node@v4
157206
with:
158207
node-version: 20
159208
registry-url: https://registry.npmjs.org
160209
env:
161210
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
162-
211+
163212
- name: Check package availability
164213
uses: ./.github/actions/check-package-availability
165214
with:
166215
package: "@infineon/infineon-design-system-vue"
167-
version: ${{ steps.build.outputs.VERSION }}
216+
version: ${{ needs.stencil-library-release.outputs.VERSION }}
168217
max-attempts: 10
169218
max-delay: 20
170219

@@ -189,14 +238,17 @@ jobs:
189238
pr-preview-angular-example/
190239
pr-preview-vanilla-example/
191240
force: false
192-
193-
deploy-master-react:
241+
242+
deploy-preview-react:
194243
needs: stencil-library-release
244+
if: needs.stencil-library-release.outputs.SKIP_REMAINING == 'false'
195245
runs-on: ubuntu-latest
246+
outputs:
247+
deployment-url: ${{ steps.preview.outputs.deployment-url }}
196248
steps:
197249
- name: Checkout
198250
uses: actions/checkout@v4
199-
251+
200252
- name: Use Node.js 20
201253
uses: actions/setup-node@v4
202254
with:
@@ -209,16 +261,17 @@ jobs:
209261
uses: ./.github/actions/check-package-availability
210262
with:
211263
package: "@infineon/infineon-design-system-react"
212-
version: ${{ steps.build.outputs.VERSION }}
264+
version: ${{ needs.stencil-library-release.outputs.VERSION }}
213265
max-attempts: 10
214266
max-delay: 20
215267

216268
- name: Install and Build
217269
run: |
218270
cd examples/wrapper-components/react-vite-js
271+
rm -rf node_modules
272+
npm install
219273
REACT_VERSION=$(jq -r '.dependencies["@infineon/infineon-design-system-react"]' package.json)
220274
STENCIL_VERSION=$(npm list @infineon/infineon-design-system-stencil --depth=1 | grep @infineon/infineon-design-system-stencil@ | awk -F@ '{print $3}')
221-
npm install
222275
echo "Installed version Stencil: $STENCIL_VERSION - Installed version React: $REACT_VERSION"
223276
npm run build
224277
@@ -237,14 +290,17 @@ jobs:
237290
pr-preview-angular-example/
238291
pr-preview-vanilla-example/
239292
force: false
240-
241-
deploy-master-angular:
293+
294+
deploy-preview-angular:
242295
needs: stencil-library-release
296+
if: needs.stencil-library-release.outputs.SKIP_REMAINING == 'false'
297+
outputs:
298+
deployment-url: ${{ steps.preview.outputs.deployment-url }}
243299
runs-on: ubuntu-latest
244300
steps:
245301
- name: Checkout
246302
uses: actions/checkout@v4
247-
303+
248304
- name: Use Node.js 20
249305
uses: actions/setup-node@v4
250306
with:
@@ -253,27 +309,26 @@ jobs:
253309
env:
254310
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
255311

256-
- name: Update package.json with version
312+
- name: Check package availability
313+
uses: ./.github/actions/check-package-availability
314+
with:
315+
package: "@infineon/infineon-design-system-angular"
316+
version: ${{ needs.stencil-library-release.outputs.VERSION }}
317+
max-attempts: 10
318+
max-delay: 20
319+
320+
- name: Update package.json with canary version
257321
run: |
258322
cd packages/components-angular
259323
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
260324
cd projects/component-library
261-
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
262-
325+
jq --arg VERSION "${{ needs.stencil-library-release.outputs.VERSION }}" '.dependencies["@infineon/infineon-design-system-stencil"] = $VERSION' package.json > package.json.tmp && mv package.json.tmp package.json
263326
- name: Install and Build
264327
run: |
265328
cd packages/components-angular
266-
npm i
329+
npm install
267330
npm run build my-app
268331
269-
- name: Check package availability
270-
uses: ./.github/actions/check-package-availability
271-
with:
272-
package: "@infineon/infineon-design-system-angular"
273-
version: ${{ steps.build.outputs.VERSION }}
274-
max-attempts: 10
275-
max-delay: 20
276-
277332
- name: Deploy 🚀
278333
uses: JamesIves/github-pages-deploy-action@v4
279334
with:
@@ -289,14 +344,17 @@ jobs:
289344
pr-preview-angular-example/
290345
pr-preview-vanilla-example/
291346
force: false
292-
293-
deploy-master-vanilla:
347+
348+
deploy-preview-vanilla:
294349
needs: stencil-library-release
350+
if: needs.stencil-library-release.outputs.SKIP_REMAINING == 'false'
295351
runs-on: ubuntu-latest
352+
outputs:
353+
deployment-url: ${{ steps.preview.outputs.deployment-url }}
296354
steps:
297355
- name: Checkout
298356
uses: actions/checkout@v4
299-
357+
300358
- name: Use Node.js 20
301359
uses: actions/setup-node@v4
302360
with:
@@ -311,7 +369,7 @@ jobs:
311369
npm install
312370
npm run update-link
313371
npm run build
314-
372+
315373
- name: Deploy 🚀
316374
uses: JamesIves/github-pages-deploy-action@v4
317375
with:
@@ -327,7 +385,7 @@ jobs:
327385
pr-preview-angular-example/
328386
pr-preview-vanilla-example/
329387
force: false
330-
388+
331389
send-webex-notification:
332390
needs: [stencil-library-release, deploy-master-vue, deploy-master-react, deploy-master-angular, deploy-master-vanilla]
333391
runs-on: ubuntu-latest

examples/wrapper-components/react-vite-js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"test:local": "run-p preview:link watch:library"
1919
},
2020
"dependencies": {
21-
"@infineon/infineon-design-system-react": "38.1.1",
21+
"@infineon/infineon-design-system-react": "38.1.2--canary.2083.e28fa020a418f70edecc21be0f2274062a77c467.0",
2222
"path": "^0.12.7",
2323
"react": "^18.3.1",
2424
"react-dom": "^18.3.1"

examples/wrapper-components/vue-javascript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"test:local": "run-p preview:link watch:library"
1616
},
1717
"dependencies": {
18-
"@infineon/infineon-design-system-vue": "38.1.1",
18+
"@infineon/infineon-design-system-vue": "38.1.2--canary.2083.e28fa020a418f70edecc21be0f2274062a77c467.0",
1919
"@vitejs/plugin-vue": "^4.0.0",
2020
"@vitejs/plugin-vue-jsx": "^4.0.0",
2121
"vite": "^5.0.12",

0 commit comments

Comments
 (0)