Skip to content

Commit f3d5e0c

Browse files
committed
Add GitHub Actions workflow for building and deploying WC Samples
1 parent d8d440f commit f3d5e0c

File tree

1 file changed

+119
-0
lines changed

1 file changed

+119
-0
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
2+
#
3+
# Prerequisites – igniteui-actions repo:
4+
# - A workflow that handles event_type 'wc-samples-cd' (add one, or confirm the correct event name).
5+
6+
name: Build and Deploy - WC Samples EN
7+
8+
on:
9+
push:
10+
branches:
11+
- vnext
12+
- master
13+
workflow_dispatch:
14+
inputs:
15+
branch:
16+
description: 'Branch to build and deploy (e.g. vnext)'
17+
required: true
18+
19+
env:
20+
BRANCH_REF: ${{ github.event.inputs.branch && format('refs/heads/{0}', github.event.inputs.branch) || github.ref }}
21+
22+
jobs:
23+
build-and-deploy:
24+
name: Build and Deploy - WC Samples EN
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
ref: ${{ env.BRANCH_REF }}
33+
34+
- name: Setup Node.js
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: '22.x'
38+
39+
- name: Create .npmrc file
40+
run: |
41+
if [ -f ".npmrc" ]; then
42+
rm .npmrc
43+
fi
44+
touch .npmrc
45+
46+
- name: Configure licensed @infragistics registry
47+
run: |
48+
echo "@infragistics:registry=https://packages.infragistics.com/npm/js-licensed/" >> .npmrc
49+
echo "//packages.infragistics.com/npm/js-licensed/:username=${{ secrets.INFRAGISTICS_NPM_USER }}" >> .npmrc
50+
echo "//packages.infragistics.com/npm/js-licensed/:_auth=${{ secrets.INFRAGISTICS_NPM_TOKEN }}" >> .npmrc
51+
52+
- name: npm install --legacy-peer-deps
53+
run: npm install --legacy-peer-deps
54+
55+
# "Uninstall all IG trial packages & re-install their licensed versions"
56+
- name: Replace trial IG packages with licensed versions
57+
shell: pwsh
58+
run: |
59+
Get-Content -Path ./.npmrc
60+
$packageJson = Get-Content -Raw ./package.json | ConvertFrom-Json
61+
$npmUninstallPackages = "npm uninstall --save "
62+
$npmInstallPackages = "npm install --legacy-peer-deps "
63+
$packageJson.dependencies.PSObject.Properties | `
64+
Where-Object {
65+
$_.Name.StartsWith("igniteui-webcomponents-") -or $_.Name.StartsWith("igniteui-dockmanager")
66+
} | `
67+
ForEach-Object {
68+
$npmUninstallPackages += $_.Name + " "
69+
$npmInstallPackages += "@infragistics/" + $_.Name + "@" + $_.Value + " "
70+
}
71+
Write-Host $npmUninstallPackages
72+
Write-Host $npmInstallPackages
73+
Invoke-Expression -Command "$npmUninstallPackages"
74+
Invoke-Expression -Command "$npmInstallPackages"
75+
76+
- name: npm run build
77+
run: npm run build
78+
79+
# Package the contents of dist folder as a zip artifact
80+
- name: Create zip artifact
81+
run: |
82+
cd dist
83+
zip -r ${{ github.workspace }}/WebComponentsSamples.zip ./
84+
85+
- name: Upload artifact
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: WebComponentsSamplesBrowser
89+
path: WebComponentsSamples.zip
90+
retention-days: 1
91+
92+
- name: Get app token
93+
id: app-token
94+
uses: actions/create-github-app-token@v2
95+
with:
96+
app-id: ${{ secrets.IGNITEUI_GITHUB_APP_ID }}
97+
private-key: ${{ secrets.IGNITEUI_GITHUB_APP_PRIVATE_KEY }}
98+
owner: IgniteUI
99+
repositories: igniteui-actions
100+
101+
- name: Trigger Deploy Workflow in IgniteUI Actions
102+
uses: actions/github-script@v8
103+
with:
104+
github-token: ${{ steps.app-token.outputs.token }}
105+
script: |
106+
await github.rest.repos.createDispatchEvent({
107+
owner: 'IgniteUI',
108+
repo: 'igniteui-actions',
109+
event_type: 'wc-samples-cd',
110+
client_payload: {
111+
calling_branch: "${{ env.BRANCH_REF }}",
112+
repository: "${{ github.repository }}",
113+
run_id: "${{ github.run_id }}",
114+
artifact_name: "WebComponentsSamplesBrowser",
115+
ref: "${{ github.ref }}",
116+
sha: "${{ github.sha }}",
117+
branch: "${{ github.ref_name }}",
118+
}
119+
});

0 commit comments

Comments
 (0)