@unisphere/nx 1.18.0 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +4 -4
  2. package/dist/generators/add-application/add-application.d.ts.map +1 -1
  3. package/dist/generators/add-application/add-application.js +74 -30
  4. package/dist/generators/add-application/schema.d.ts +2 -1
  5. package/dist/generators/add-application/schema.json +16 -33
  6. package/dist/generators/add-application/templates/default/package.json.template +2 -1
  7. package/dist/generators/add-application/templates/default/src/app/app.tsx.template +24 -3
  8. package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/package.json +2 -4
  9. package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/app.tsx.template +8 -12
  10. package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/components/header.tsx.template +1 -1
  11. package/dist/generators/add-package/add-package.d.ts.map +1 -1
  12. package/dist/generators/add-package/add-package.js +9 -1
  13. package/dist/generators/add-package/schema.d.ts +1 -0
  14. package/dist/generators/add-package/schema.json +29 -1
  15. package/dist/generators/add-runtime/add-runtime.d.ts.map +1 -1
  16. package/dist/generators/add-runtime/add-runtime.js +14 -6
  17. package/dist/generators/add-runtime/schema.d.ts +1 -0
  18. package/dist/generators/add-runtime/schema.json +44 -2
  19. package/dist/generators/add-runtime/templates/new-runtime/src/lib/create-factory.tsx.template +13 -12
  20. package/dist/generators/dependency-config.d.ts +23 -0
  21. package/dist/generators/dependency-config.d.ts.map +1 -0
  22. package/dist/generators/dependency-config.js +134 -0
  23. package/dist/generators/unisphere-migrate/run-locally.md +4 -1
  24. package/dist/generators/unisphere-migrate/upgrade-guide.md +22 -6
  25. package/dist/migrations/update-1-1-5/templates/_publish-artifacts.template +210 -0
  26. package/dist/migrations/update-1-1-5/templates/cicd.template +13 -3
  27. package/dist/migrations/update-1-1-5/update-github-workflow.d.ts.map +1 -1
  28. package/dist/migrations/update-1-1-5/update-github-workflow.js +28 -17
  29. package/package.json +2 -2
  30. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/.babelrc +0 -0
  31. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/.eslintrc.json +0 -0
  32. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/jest.config.ts +0 -0
  33. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/project.json +0 -0
  34. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/components/settings-buttons.tsx +0 -0
  35. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/components/settings-form.tsx +0 -0
  36. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/components/settings.tsx +0 -0
  37. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/configuration-provider.tsx +0 -0
  38. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/definitions.ts +0 -0
  39. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/app/utils/merge-deep.ts +0 -0
  40. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/favicon.ico +0 -0
  41. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/index.html +0 -0
  42. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/main.tsx +0 -0
  43. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/src/styles.css +0 -0
  44. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/tsconfig.app.json +0 -0
  45. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/tsconfig.json +0 -0
  46. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/tsconfig.spec.json +0 -0
  47. /package/dist/generators/add-application/templates/{interactive-playground → local-dev-playground}/webpack.config.js +0 -0
@@ -1,21 +1,22 @@
1
- import { Root } from 'react-dom/client';
2
- import { Runtime } from './runtime';
3
- import { <%= runtimeName__pascalCase %>RuntimeSettings } from '<%= coreAlias %>'
4
1
  import {
5
- CreateElementOptions,
6
2
  UnisphereElementBase,
7
3
  UnisphereElementFactory,
4
+ CreateElementOptions,
8
5
  } from '@unisphere/runtime-js';
6
+ import { Root } from 'react-dom/client';
7
+ import { Runtime } from './runtime';
9
8
 
10
- class ContextFactory extends UnisphereElementFactory<
11
- <%= runtimeName__pascalCase %>RuntimeSettings,
12
- Root
13
- > {
14
- create(
15
- options: CreateElementOptions<<%= runtimeName__pascalCase %>RuntimeSettings>
16
- ): UnisphereElementBase<<%= runtimeName__pascalCase %>RuntimeSettings, Root> {
17
- return new Runtime(options);
9
+ class ContextFactory extends UnisphereElementFactory<Record<string, any>, Root> {
10
+ create<T extends Record<string, any>>(
11
+ options: CreateElementOptions<T>
12
+ ): UnisphereElementBase<T, Root> {
13
+ switch (options.flavor) {
14
+ default:
15
+ return new Runtime(options) as any;
16
+ }
18
17
  }
19
18
  }
20
19
 
21
20
  export const createFactory = () => new ContextFactory();
21
+
22
+
@@ -0,0 +1,23 @@
1
+ import { Tree } from '@nx/devkit';
2
+ /**
3
+ * Dependency version mappings with default versions from workspace
4
+ */
5
+ export declare const DEPENDENCY_MAP: Record<string, {
6
+ packages: string[];
7
+ defaultVersions?: Record<string, string>;
8
+ }>;
9
+ /**
10
+ * Validates that GIT_TOKEN environment variable exists when Kaltura DS is selected
11
+ * @throws Error if GIT_TOKEN is not found
12
+ */
13
+ export declare function validateGitToken(selectedDependencies: string[]): void;
14
+ /**
15
+ * Validates and auto-corrects package/runtime name to include -react suffix
16
+ * when React or Kaltura DS dependencies are selected
17
+ */
18
+ export declare function validateReactNaming(name: string, selectedDependencies: string[]): string;
19
+ /**
20
+ * Installs selected dependencies, skipping those already installed
21
+ */
22
+ export declare function installSelectedDependencies(tree: Tree, selectedDependencies: string[]): void;
23
+ //# sourceMappingURL=dependency-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependency-config.d.ts","sourceRoot":"","sources":["../../src/generators/dependency-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAU,MAAM,YAAY,CAAC;AAI1C;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CACjC,MAAM,EACN;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAgDjE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,oBAAoB,EAAE,MAAM,EAAE,GAAG,IAAI,CAkBrE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,oBAAoB,EAAE,MAAM,EAAE,GAC7B,MAAM,CAiBR;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,IAAI,EACV,oBAAoB,EAAE,MAAM,EAAE,GAC7B,IAAI,CA0CN"}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEPENDENCY_MAP = void 0;
4
+ exports.validateGitToken = validateGitToken;
5
+ exports.validateReactNaming = validateReactNaming;
6
+ exports.installSelectedDependencies = installSelectedDependencies;
7
+ const devkit_1 = require("@nx/devkit");
8
+ const child_process_1 = require("child_process");
9
+ const utils_1 = require("./utils");
10
+ /**
11
+ * Dependency version mappings with default versions from workspace
12
+ */
13
+ exports.DEPENDENCY_MAP = {
14
+ react: {
15
+ packages: ['react', 'react-dom'],
16
+ defaultVersions: {
17
+ 'react': '^19.0.0',
18
+ 'react-dom': '^19.0.0',
19
+ },
20
+ },
21
+ ds: {
22
+ packages: [
23
+ '@kaltura/ds-react-bits',
24
+ '@kaltura/ds-react-icons',
25
+ '@kaltura/ds-react-theme',
26
+ '@kaltura/ds-react-utils',
27
+ '@mui/material',
28
+ '@mui/icons-material',
29
+ '@emotion/react',
30
+ '@emotion/styled',
31
+ ],
32
+ defaultVersions: {
33
+ '@kaltura/ds-react-bits': '^12.2.0',
34
+ '@kaltura/ds-react-icons': '^12.2.0',
35
+ '@kaltura/ds-react-theme': '^12.2.0',
36
+ '@kaltura/ds-react-utils': '^12.2.0',
37
+ '@mui/material': '^7.3.4',
38
+ '@mui/icons-material': '^7.3.4',
39
+ '@emotion/react': '11.14.0',
40
+ '@emotion/styled': '11.14.1',
41
+ },
42
+ },
43
+ mui: {
44
+ packages: ['@mui/material', '@mui/icons-material', '@emotion/react', '@emotion/styled'],
45
+ defaultVersions: {
46
+ '@mui/material': '^7.3.4',
47
+ '@mui/icons-material': '^7.3.4',
48
+ '@emotion/react': '11.14.0',
49
+ '@emotion/styled': '11.14.1',
50
+ },
51
+ },
52
+ 'react-hook-form': {
53
+ packages: ['react-hook-form', 'react', 'react-dom'],
54
+ defaultVersions: {
55
+ 'react-hook-form': '^7.52.0',
56
+ 'react': '^19.0.0',
57
+ 'react-dom': '^19.0.0',
58
+ },
59
+ },
60
+ };
61
+ /**
62
+ * Validates that GIT_TOKEN environment variable exists when Kaltura DS is selected
63
+ * @throws Error if GIT_TOKEN is not found
64
+ */
65
+ function validateGitToken(selectedDependencies) {
66
+ if (selectedDependencies.includes('ds')) {
67
+ const gitToken = process.env.GIT_TOKEN;
68
+ if (!gitToken) {
69
+ devkit_1.logger.error('');
70
+ devkit_1.logger.error('❌ Error: Kaltura DS requires GIT_TOKEN environment variable');
71
+ devkit_1.logger.error('');
72
+ devkit_1.logger.error('Please set up your GitHub token to access Kaltura packages.');
73
+ devkit_1.logger.error('Documentation: https://unisphere.kaltura.com/docs/create/overview');
74
+ devkit_1.logger.error('');
75
+ throw new Error('GIT_TOKEN environment variable is required for Kaltura DS');
76
+ }
77
+ }
78
+ }
79
+ /**
80
+ * Validates and auto-corrects package/runtime name to include -react suffix
81
+ * when React or Kaltura DS dependencies are selected
82
+ */
83
+ function validateReactNaming(name, selectedDependencies) {
84
+ const needsReactSuffix = selectedDependencies.includes('react') ||
85
+ selectedDependencies.includes('ds');
86
+ if (needsReactSuffix && !name.endsWith('-react')) {
87
+ const suggestedName = `${name}-react`;
88
+ devkit_1.logger.warn('');
89
+ devkit_1.logger.warn(`⚠️ Package/Runtime name should end with '-react' when using React or Kaltura DS`);
90
+ devkit_1.logger.info(` Renaming to: ${suggestedName}`);
91
+ devkit_1.logger.warn('');
92
+ return suggestedName;
93
+ }
94
+ return name;
95
+ }
96
+ /**
97
+ * Installs selected dependencies, skipping those already installed
98
+ */
99
+ function installSelectedDependencies(tree, selectedDependencies) {
100
+ if (!selectedDependencies || selectedDependencies.length === 0) {
101
+ return;
102
+ }
103
+ devkit_1.logger.info('');
104
+ devkit_1.logger.info('📦 Installing selected dependencies...');
105
+ for (const dep of selectedDependencies) {
106
+ const depConfig = exports.DEPENDENCY_MAP[dep];
107
+ if (!depConfig) {
108
+ devkit_1.logger.warn(`⚠️ Unknown dependency: ${dep}`);
109
+ continue;
110
+ }
111
+ for (const packageName of depConfig.packages) {
112
+ const installedVersion = (0, utils_1.isPackageInstalled)(tree, packageName);
113
+ if (installedVersion) {
114
+ devkit_1.logger.info(`✅ ${packageName}@${installedVersion} already installed`);
115
+ continue;
116
+ }
117
+ // Determine version to install from defaultVersions map or fallback
118
+ const version = depConfig.defaultVersions?.[packageName] || '^1.0.0';
119
+ const installCommand = `npm install ${packageName}@${version}`;
120
+ devkit_1.logger.info(` Installing ${packageName}@${version}...`);
121
+ try {
122
+ (0, child_process_1.execSync)(installCommand, {
123
+ cwd: process.cwd(),
124
+ stdio: 'inherit',
125
+ });
126
+ devkit_1.logger.info(`✅ ${packageName}@${version} installed successfully`);
127
+ }
128
+ catch (error) {
129
+ devkit_1.logger.error(`❌ Failed to install ${packageName}: ${error}`);
130
+ }
131
+ }
132
+ }
133
+ devkit_1.logger.info('');
134
+ }
@@ -15,4 +15,7 @@ npx nx g {path}/unisphere-nx-workspace-plugin/packages/nx:unisphere-migrate
15
15
  This will run ALL migrations defined in migrations.json manually.
16
16
 
17
17
 
18
- npx nx g /home/tokomeno/kaltura/unisphere/pl/unisphere-nx-workspace-plugin/packages/nx:unisphere-migrate
18
+ npx nx g /home/tokomeno/kaltura/unisphere/unisphere-nx-workspace-plugin/packages/nx:unisphere-migrate
19
+
20
+
21
+ npx nx g /home/tokomeno/kaltura/unisphere/unisphere-nx-workspace-plugin/packages/nx:add-application
@@ -1,3 +1,25 @@
1
+
2
+ ### Unisphere-migrate
3
+
4
+ **Purpose:** A comprehensive migration guide and generator for upgrading Unisphere workspaces to the latest tech stack.
5
+
6
+ **What It Does:**
7
+ - Guides developers through a major version upgrade of their Unisphere workspace
8
+ - Automates code transformations for breaking changes across:
9
+ - React 18 → 19 (breaking changes in types and patterns)
10
+ - MUI v5/v6 → v7 (breaking API changes)
11
+ - Node.js version upgrades
12
+ - All @unisphere and @kaltura packages
13
+ - Sequences upgrade steps in the correct order (Nx first, then Unisphere)
14
+ - Provides safety measures (git commits, clean installs, verification steps)
15
+
16
+ **Key Features:**
17
+ - User-facing documentation for manual steps (environment setup, Node.js switching)
18
+ - Automated migration generator for code transformations
19
+ - Handles dependencies across multiple major version bumps
20
+ - Verification steps to ensure successful upgrade
21
+
22
+
1
23
  # Unisphere Nx Workspace Upgrade Guide
2
24
 
3
25
  This guide walks you through upgrading your Unisphere workspace to the latest version with Nx 22, React 19, MUI v7, and Node.js 24.
@@ -84,9 +106,3 @@ If you encounter React 19 compatibility issues, you may need to:
84
106
  npm run check
85
107
  ```
86
108
 
87
- ## What Changed
88
-
89
- - **React**: Upgraded to v19
90
- - **MUI**: Upgraded to v7
91
- - **Node.js**: Updated to v24
92
- - **All @unisphere and @kaltura packages**: Updated to latest versions
@@ -0,0 +1,210 @@
1
+ name: Shared Deployment Jobs
2
+
3
+ on:
4
+ workflow_call:
5
+
6
+ jobs:
7
+ prepare-runtimes:
8
+ runs-on:
9
+ - codebuild-ovp-unisphere-runner-${{ github.run_id }}-${{ github.attempt }}
10
+ - instance-size:medium
11
+ outputs:
12
+ unisphereElementsArtifactsFolder: ${{ steps.prepare-runtimes.outputs.artifactsRootFolder }}
13
+ hasArtifacts: ${{ steps.prepare-runtimes.outputs.hasArtifacts }}
14
+ commit_sha: ${{ steps.capture_commit_sha.outputs.commit_sha }}
15
+ steps:
16
+ - name: Checkout Repo
17
+ uses: actions/checkout@v3
18
+ with:
19
+ ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
20
+ fetch-tags: true
21
+ - name: Setup Node.js
22
+ uses: actions/setup-node@v4
23
+ with:
24
+ node-version-file: '.nvmrc'
25
+ - name: Clean workspace
26
+ run: git reset --hard HEAD
27
+ - name: Clean npm cache
28
+ run: npm cache clean --force
29
+ - name: Install dependencies
30
+ run: npm ci --include=optional
31
+ env:
32
+ GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33
+ - name: Prepare Unisphere Elements
34
+ id: prepare-runtimes
35
+ run: npx unisphere runtime publish prepare --verbose
36
+ - name: Capture Commit SHA
37
+ id: capture_commit_sha
38
+ run: echo "commit_sha=$(git rev-parse HEAD)" >> $GITHUB_ENV
39
+ - name: Set commit_sha as output
40
+ id: set_commit_sha
41
+ run: echo "commit_sha=${{ env.commit_sha }}" >> $GITHUB_OUTPUT
42
+ - uses: actions/upload-artifact@v4
43
+ id: upload-unisphere-elements-artifacts
44
+ with:
45
+ name: unisphere-elements
46
+ path: ${{ steps.prepare-runtimes.outputs.artifactsRootFolder }}
47
+ retention-days: 1
48
+
49
+ deploy-runtimes:
50
+ if: needs.prepare-runtimes.outputs.hasArtifacts == 'true'
51
+ needs: prepare-runtimes
52
+ runs-on:
53
+ - codebuild-ovp-unisphere-runner-${{ github.run_id }}-${{ github.attempt }}
54
+ - instance-size:medium
55
+ strategy:
56
+ matrix:
57
+ envs_regions:
58
+ - { env: 'nvp1', region: 'us-east-1', accountid: '583352821080' }
59
+ - { env: 'frp2', region: 'eu-central-1', accountid: '082111255551' }
60
+ - { env: 'irp2', region: 'eu-west-1', accountid: '137576761235' }
61
+ - { env: 'nvq2', region: 'us-east-1', accountid: '383697330906' }
62
+ - { env: 'sgp2', region: 'ap-southeast-1', accountid: '882351240370' }
63
+ - { env: 'syp2', region: 'ap-southeast-2', accountid: '650755435642' }
64
+ - { env: 'cap2', region: 'ca-central-1', accountid: '948632009361' }
65
+ fail-fast: false
66
+ steps:
67
+ - name: Checkout Repo at specific commit
68
+ uses: actions/checkout@v3
69
+ with:
70
+ ref: ${{ needs.prepare-runtimes.outputs.commit_sha }}
71
+ fetch-tags: true
72
+ - name: Setup Node.js
73
+ uses: actions/setup-node@v4
74
+ with:
75
+ node-version-file: '.nvmrc'
76
+ - name: Install dependencies
77
+ run: npm ci --include=optional
78
+ env:
79
+ GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80
+ - name: Download artifacts folder
81
+ uses: actions/download-artifact@v4
82
+ with:
83
+ name: unisphere-elements
84
+ path: ${{ needs.prepare-runtimes.outputs.unisphereElementsArtifactsFolder }}
85
+ - name: Sync S3 bucket
86
+ run: |
87
+ npx unisphere runtime publish execute \
88
+ --env ${{ matrix.envs_regions.env }} \
89
+ --aws-region '${{ matrix.envs_regions.region }}' \
90
+ --aws-arn 'arn:aws:iam::${{matrix.envs_regions.accountid }}:role/${{ matrix.envs_regions.env }}-unisphere-content-role' \
91
+ --artifacts-folder '${{ needs.prepare-runtimes.outputs.unisphereElementsArtifactsFolder }}' \
92
+ --verbose
93
+
94
+ deploy-packages:
95
+ if: always()
96
+ needs: [prepare-runtimes, deploy-runtimes]
97
+ runs-on:
98
+ - codebuild-ovp-unisphere-runner-${{ github.run_id }}-${{ github.attempt }}
99
+ - instance-size:medium
100
+ steps:
101
+ - name: Checkout Repo
102
+ uses: actions/checkout@v3
103
+ with:
104
+ ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
105
+ fetch-tags: true
106
+ - name: Setup Node.js
107
+ uses: actions/setup-node@v4
108
+ with:
109
+ node-version: 20
110
+ - name: Install dependencies
111
+ run: npm ci --include=optional
112
+ env:
113
+ GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114
+ - name: Get NPM Token from AWS Secrets Manager
115
+ id: get-npm-token
116
+ run: |
117
+ NPM_TOKEN=$(aws secretsmanager get-secret-value --secret-id arn:aws:secretsmanager:eu-central-1:785328604905:secret:unisphere-secrets-um86Cs --query SecretString --output text | jq -r '."NPM_UNISPHERE_TOKEN"')
118
+ echo "NPM_TOKEN=$NPM_TOKEN" >> $GITHUB_ENV
119
+ echo "::debug::Token exists: $([ ! -z "$NPM_TOKEN" ] && echo 'true' || echo 'false')"
120
+ - name: Deploy to registry
121
+ run: npx unisphere package publish --verbose --githubToken ${{ secrets.GITHUB_TOKEN }} --npmToken ${{ env.NPM_TOKEN }} --branch "${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}"
122
+
123
+ prepare-applications:
124
+ if: always()
125
+ needs: [prepare-runtimes, deploy-runtimes]
126
+ runs-on:
127
+ - codebuild-ovp-unisphere-runner-${{ github.run_id }}-${{ github.attempt }}
128
+ - instance-size:medium
129
+ outputs:
130
+ unisphereApplicationsArtifactsFolder: ${{ steps.prepare-applications.outputs.artifactsRootFolder }}
131
+ hasArtifacts: ${{ steps.prepare-applications.outputs.hasArtifacts }}
132
+ commit_sha: ${{ steps.capture_commit_sha.outputs.commit_sha }}
133
+ steps:
134
+ - name: Checkout Repo
135
+ uses: actions/checkout@v3
136
+ with:
137
+ ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
138
+ fetch-tags: true
139
+ - name: Setup Node.js
140
+ uses: actions/setup-node@v4
141
+ with:
142
+ node-version-file: '.nvmrc'
143
+ - name: Clean workspace
144
+ run: git reset --hard HEAD
145
+ - name: Clean npm cache
146
+ run: npm cache clean --force
147
+ - name: Install dependencies
148
+ run: npm ci --include=optional
149
+ env:
150
+ GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151
+ - name: Prepare Unisphere Applications
152
+ id: prepare-applications
153
+ run: npx unisphere application publish prepare --verbose
154
+ - name: Capture Commit SHA
155
+ id: capture_commit_sha
156
+ run: echo "commit_sha=$(git rev-parse HEAD)" >> $GITHUB_ENV
157
+ - name: Set commit_sha as output
158
+ id: set_commit_sha
159
+ run: echo "commit_sha=${{ env.commit_sha }}" >> $GITHUB_OUTPUT
160
+ - uses: actions/upload-artifact@v4
161
+ id: upload-unisphere-applications-artifacts
162
+ with:
163
+ name: unisphere-applications
164
+ path: ${{ steps.prepare-applications.outputs.artifactsRootFolder }}
165
+ retention-days: 1
166
+
167
+ deploy-applications:
168
+ if: always() && needs.prepare-applications.outputs.hasArtifacts == 'true'
169
+ needs: [prepare-applications, deploy-runtimes]
170
+ runs-on:
171
+ - codebuild-ovp-unisphere-runner-${{ github.run_id }}-${{ github.attempt }}
172
+ - instance-size:medium
173
+ strategy:
174
+ matrix:
175
+ envs_regions:
176
+ - { env: 'nvp1', region: 'us-east-1', accountid: '583352821080' }
177
+ - { env: 'frp2', region: 'eu-central-1', accountid: '082111255551' }
178
+ - { env: 'irp2', region: 'eu-west-1', accountid: '137576761235' }
179
+ - { env: 'nvq2', region: 'us-east-1', accountid: '383697330906' }
180
+ - { env: 'sgp2', region: 'ap-southeast-1', accountid: '882351240370' }
181
+ - { env: 'syp2', region: 'ap-southeast-2', accountid: '650755435642' }
182
+ - { env: 'cap2', region: 'ca-central-1', accountid: '948632009361' }
183
+ fail-fast: false
184
+ steps:
185
+ - name: Checkout Repo at specific commit
186
+ uses: actions/checkout@v3
187
+ with:
188
+ ref: ${{ needs.prepare-applications.outputs.commit_sha }}
189
+ fetch-tags: true
190
+ - name: Setup Node.js
191
+ uses: actions/setup-node@v4
192
+ with:
193
+ node-version: 20
194
+ - name: Install dependencies
195
+ run: npm ci --include=optional
196
+ env:
197
+ GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
198
+ - name: Download artifacts folder
199
+ uses: actions/download-artifact@v4
200
+ with:
201
+ name: unisphere-applications
202
+ path: ${{ needs.prepare-applications.outputs.unisphereApplicationsArtifactsFolder }}
203
+ - name: Sync S3 bucket
204
+ run: |
205
+ npx unisphere application publish execute \
206
+ --env ${{ matrix.envs_regions.env }} \
207
+ --aws-region '${{ matrix.envs_regions.region }}' \
208
+ --aws-arn 'arn:aws:iam::${{matrix.envs_regions.accountid }}:role/${{ matrix.envs_regions.env }}-unisphere-content-role' \
209
+ --artifacts-folder '${{ needs.prepare-applications.outputs.unisphereApplicationsArtifactsFolder }}' \
210
+ --verbose
@@ -18,10 +18,15 @@ jobs:
18
18
  - name: Check if part of prerelease or official release
19
19
  id: check
20
20
  run: |
21
- if [ ! -f ".changeset/pre.json" ] && [ "${{ github.ref }}" != "refs/heads/main" ]; then
21
+ if [ "${{ github.ref }}" = "refs/heads/main" ] && [ -f ".changeset/pre.json" ]; then
22
+ echo "main branch should not have pre.json file, skipping job"
23
+ exit 1
24
+ elif [[ "${{ github.ref }}" == "refs/heads/prerelease/"* ]] && [ ! -f ".changeset/pre.json" ]; then
25
+ echo "prerelease branch must have pre.json file, skipping job"
26
+ exit 1
27
+ elif [ "${{ github.ref }}" != "refs/heads/main" ] && [[ "${{ github.ref }}" != "refs/heads/prerelease/"* ]]; then
22
28
  echo "not part of prerelease or official release, skipping job"
23
- echo "::stop-commands::`date +%s`"
24
- exit 0
29
+ exit 1
25
30
  fi
26
31
 
27
32
  - name: Checkout Repo
@@ -32,6 +37,11 @@ jobs:
32
37
  with:
33
38
  node-version-file: '.nvmrc'
34
39
 
40
+ - name: Run Kaltura Tools Check
41
+ uses: kaltura/kaltura-tools@main
42
+ with:
43
+ repo-path: '${{ github.workspace }}'
44
+
35
45
  - name: Install Dependencies
36
46
  run: npm ci --include=optional
37
47
  env:
@@ -1 +1 @@
1
- {"version":3,"file":"update-github-workflow.d.ts","sourceRoot":"","sources":["../../../src/migrations/update-1-1-5/update-github-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAU,MAAM,YAAY,CAAC;AAI1C,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAmC9D"}
1
+ {"version":3,"file":"update-github-workflow.d.ts","sourceRoot":"","sources":["../../../src/migrations/update-1-1-5/update-github-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAU,MAAM,YAAY,CAAC;AAI1C,wBAA8B,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA6C9D"}
@@ -5,31 +5,42 @@ const devkit_1 = require("@nx/devkit");
5
5
  const fs_1 = require("fs");
6
6
  const path_1 = require("path");
7
7
  async function update(tree) {
8
- devkit_1.logger.info('🔄 Updating .github/workflows/cicd.yml from template...');
9
- const workflowPath = '.github/workflows/cicd.yml';
10
- const templatePath = (0, path_1.join)(__dirname, 'templates', 'cicd.template');
8
+ devkit_1.logger.info('🔄 Updating .github/workflows files from templates...');
9
+ // Ensure .github/workflows directory exists
10
+ if (!tree.exists('.github')) {
11
+ tree.write('.github/.gitkeep', '');
12
+ devkit_1.logger.info('✅ Created .github directory');
13
+ }
14
+ if (!tree.exists('.github/workflows')) {
15
+ tree.write('.github/workflows/.gitkeep', '');
16
+ devkit_1.logger.info('✅ Created .github/workflows directory');
17
+ }
11
18
  try {
12
- // Read the template file
13
- const templateContent = (0, fs_1.readFileSync)(templatePath, 'utf-8');
14
- // Ensure .github/workflows directory exists
15
- if (!tree.exists('.github')) {
16
- tree.write('.github/.gitkeep', '');
17
- devkit_1.logger.info('✅ Created .github directory');
19
+ // Update cicd.yml
20
+ const cicdWorkflowPath = '.github/workflows/cicd.yml';
21
+ const cicdTemplatePath = (0, path_1.join)(__dirname, 'templates', 'cicd.template');
22
+ const cicdTemplateContent = (0, fs_1.readFileSync)(cicdTemplatePath, 'utf-8');
23
+ tree.write(cicdWorkflowPath, cicdTemplateContent);
24
+ if (tree.exists(cicdWorkflowPath)) {
25
+ devkit_1.logger.info(`✅ Updated ${cicdWorkflowPath} from template`);
18
26
  }
19
- if (!tree.exists('.github/workflows')) {
20
- tree.write('.github/workflows/.gitkeep', '');
21
- devkit_1.logger.info('✅ Created .github/workflows directory');
27
+ else {
28
+ devkit_1.logger.info(`✅ Created ${cicdWorkflowPath} from template`);
22
29
  }
23
- tree.write(workflowPath, templateContent);
24
- if (tree.exists(workflowPath)) {
25
- devkit_1.logger.info(`✅ Updated ${workflowPath} from template`);
30
+ // Update _publish-artifacts.yml
31
+ const publishArtifactsWorkflowPath = '.github/workflows/_publish-artifacts.yml';
32
+ const publishArtifactsTemplatePath = (0, path_1.join)(__dirname, 'templates', '_publish-artifacts.template');
33
+ const publishArtifactsTemplateContent = (0, fs_1.readFileSync)(publishArtifactsTemplatePath, 'utf-8');
34
+ tree.write(publishArtifactsWorkflowPath, publishArtifactsTemplateContent);
35
+ if (tree.exists(publishArtifactsWorkflowPath)) {
36
+ devkit_1.logger.info(`✅ Updated ${publishArtifactsWorkflowPath} from template`);
26
37
  }
27
38
  else {
28
- devkit_1.logger.info(`✅ Created ${workflowPath} from template`);
39
+ devkit_1.logger.info(`✅ Created ${publishArtifactsWorkflowPath} from template`);
29
40
  }
30
41
  }
31
42
  catch (error) {
32
- devkit_1.logger.error(`❌ Failed to update GitHub workflow: ${error?.message || 'Unknown error'}`);
43
+ devkit_1.logger.error(`❌ Failed to update GitHub workflows: ${error?.message || 'Unknown error'}`);
33
44
  throw error;
34
45
  }
35
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisphere/nx",
3
- "version": "1.18.0",
3
+ "version": "1.20.0",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -95,4 +95,4 @@
95
95
  "nx-migrations": {
96
96
  "migrations": "./migrations.json"
97
97
  }
98
- }
98
+ }