|
1 | 1 | /* eslint-disable no-console */ |
2 | 2 | import * as childProcess from 'child_process'; |
3 | | -import * as path from 'path'; |
4 | | -import { PUBLISH_PACKAGES_DOCKER_IMAGE_NAME, TEST_REGISTRY_CONTAINER_NAME, VERDACCIO_VERSION } from './lib/constants'; |
5 | | - |
6 | | -const publishScriptNodeVersion = process.env.E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION; |
7 | | -const repositoryRoot = path.resolve(__dirname, '../..'); |
| 3 | +import { TEST_REGISTRY_CONTAINER_NAME, VERDACCIO_VERSION } from './lib/constants'; |
| 4 | +import { publishPackages } from './lib/publishPackages'; |
8 | 5 |
|
9 | 6 | // https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines |
10 | 7 | function groupCIOutput(groupTitle: string, fn: () => void): void { |
@@ -45,56 +42,7 @@ export function registrySetup(): void { |
45 | 42 | throw new Error('Start Registry Process failed.'); |
46 | 43 | } |
47 | 44 |
|
48 | | - // Build container image that is uploading our packages to fake registry with specific Node.js/npm version |
49 | | - const buildPublishImageProcessResult = childProcess.spawnSync( |
50 | | - 'docker', |
51 | | - [ |
52 | | - 'build', |
53 | | - '--tag', |
54 | | - PUBLISH_PACKAGES_DOCKER_IMAGE_NAME, |
55 | | - '--file', |
56 | | - './Dockerfile.publish-packages', |
57 | | - ...(publishScriptNodeVersion ? ['--build-arg', `NODE_VERSION=${publishScriptNodeVersion}`] : []), |
58 | | - '.', |
59 | | - ], |
60 | | - { |
61 | | - encoding: 'utf8', |
62 | | - stdio: 'inherit', |
63 | | - }, |
64 | | - ); |
65 | | - |
66 | | - if (buildPublishImageProcessResult.status !== 0) { |
67 | | - throw new Error('Build Publish Image failed.'); |
68 | | - } |
69 | | - |
70 | | - // Run container that uploads our packages to fake registry |
71 | | - const publishImageContainerRunProcess = childProcess.spawnSync( |
72 | | - 'docker', |
73 | | - [ |
74 | | - 'run', |
75 | | - '--rm', |
76 | | - '-v', |
77 | | - `${repositoryRoot}:/sentry-javascript`, |
78 | | - '--network', |
79 | | - 'host', |
80 | | - PUBLISH_PACKAGES_DOCKER_IMAGE_NAME, |
81 | | - ], |
82 | | - { |
83 | | - encoding: 'utf8', |
84 | | - stdio: 'inherit', |
85 | | - }, |
86 | | - ); |
87 | | - |
88 | | - const statusCode = publishImageContainerRunProcess.status; |
89 | | - |
90 | | - if (statusCode !== 0) { |
91 | | - if (statusCode === 137) { |
92 | | - throw new Error( |
93 | | - `Publish Image Container failed with exit code ${statusCode}, possibly due to memory issues. Consider increasing the memory limit for the container.`, |
94 | | - ); |
95 | | - } |
96 | | - throw new Error(`Publish Image Container failed with exit code ${statusCode}`); |
97 | | - } |
| 45 | + publishPackages(); |
98 | 46 | }); |
99 | 47 |
|
100 | 48 | console.log(''); |
|
0 commit comments