MCPcopy Index your code
hub / github.com/QwikDev/qwik / publish

Function publish

scripts/release.ts:143–231  ·  view source on GitHub ↗
(config: BuildConfig)

Source from the content-addressed store, hash-verified

141}
142
143export async function publish(config: BuildConfig) {
144 const isDryRun = !!config.dryRun;
145
146 const qwikDir = join(config.packagesDir, 'qwik');
147 const distPkg = await readPackageJson(qwikDir);
148 const gitTag = `v${distPkg.version}`;
149 const distTag = config.setDistTag || 'dev';
150
151 console.log(`🚢 publishing ${distPkg.version}`, isDryRun ? '(dry-run)' : '');
152
153 // create a pack.tgz which is useful for debugging and uploaded as an artifact
154 const pkgTarName = `builder.io-qwik-${distPkg.version}.tgz`;
155 await execa('npm', ['pack'], { cwd: qwikDir });
156 await execa('mv', [pkgTarName, '../'], { cwd: qwikDir });
157
158 // make sure our build is good to go and has the files we expect
159 // and each of the files can be parsed correctly
160 await validateBuild(config);
161
162 // check all is good with an npm publish --dry-run before we continue
163 // dry-run does everything the same except actually publish to npm
164 const npmPublishArgs = ['publish', '--tag', distTag, '--access', 'public'];
165
166 const qwikCityDir = join(config.packagesDir, 'qwik-city');
167 // publish @builder.io/qwik-city (dry-run)
168 await run('npm', npmPublishArgs, true, true, { cwd: qwikCityDir });
169
170 // publish @builder.io/qwik (dry-run)
171 await run('npm', npmPublishArgs, true, true, { cwd: qwikDir });
172
173 // looks like the npm publish --dry-run was successful and
174 // we have more confidence that it should work on a real publish
175
176 // set the user git config email
177 const actor = process.env.GITHUB_ACTOR || 'builderbot';
178 const actorEmail = `${actor}@users.noreply.github.com`;
179 const gitConfigEmailArgs = ['config', 'user.email', actorEmail];
180 await run('git', gitConfigEmailArgs, isDryRun);
181
182 // set the user git config name
183 const gitConfigNameArgs = ['config', 'user.name', actor];
184 await run('git', gitConfigNameArgs, isDryRun);
185
186 // git tag this commit
187 const gitTagArgs = ['tag', '-f', '-m', distPkg.version, gitTag];
188 await run('git', gitTagArgs, isDryRun);
189
190 if (isDryRun) {
191 // git push only logs and does not execute in this dry run
192 const gitPushArgs = ['push', '--follow-tags'];
193 await run('git', gitPushArgs, true, false);
194 } else {
195 // production release
196 // git push to the repo w/ --dry-run flag to make sure we're good before publishing
197 const gitPushArgs = ['push', '--follow-tags'];
198 if (!config.devRelease) {
199 await run('git', gitPushArgs, false, true);
200 }

Callers 1

buildFunction · 0.90

Calls 7

readPackageJsonFunction · 0.90
validateBuildFunction · 0.90
runFunction · 0.90
publishCreateQwikCliFunction · 0.90
publishEslintFunction · 0.90
joinFunction · 0.85
createGithubReleaseFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…