@samitouri / QOS-React-2 / commits / a8c6a1b34e

Update release scripts to support experimental releases (#17086)

* Download correct artifacts for release channel Experimental builds should pull artifacts from the `process_artifacts_experimental` job. I think instead of two separate CI workflows, a better approach might be to build stable artifacts to the `build` directory and the experimental artifacts to a `build_experimental` directory, and generate both within the same workflow. This would take some work since lots of things assume the output directory is `build`, but something to consider in the future. * Prevent experimental promotion to stable Adds a check to the `prepare-stable` script to prevent experimental builds from being published using stable semver versions.

Andrew Clark committed Oct 14, 2019 at 14:15 UTC a8c6a1b34e93f88f285a1a042bf473f39a30c886
2 files changed +15 -3
scripts/release/prepare-stable.js
+8
@@ -14,6 +14,7 @@ const printPrereleaseSummary = require('./shared-commands/print-prerelease-summa
14 const testPackagingFixture = require('./shared-commands/test-packaging-fixture');
15 const testTracingFixture = require('./shared-commands/test-tracing-fixture');
16 const updateStableVersionNumbers = require('./prepare-stable-commands/update-stable-version-numbers');
17 +const theme = require('./theme');
18
19 const run = async () => {
20 try {
@@ -30,6 +31,13 @@ const run = async () => {
31 params.version = await getLatestCanaryVersion();
32 }
33
34 + if (params.version.includes('experimental')) {
35 + console.error(
36 + theme.error`Cannot promote an experimental build to stable.`
37 + );
38 + process.exit(1);
39 + }
40 +
41 await checkOutPackages(params);
42 await guessStableVersionNumbers(params, versionsMap);
43 await confirmStableVersionNumbers(params, versionsMap);
scripts/release/utils.js
+7 -3
@@ -51,18 +51,22 @@ const getArtifactsList = async buildID => {
51 );
52 process.exit(1);
53 }
54 -
54 + const artifactsJobName = buildMetadata.workflows.job_name.endsWith(
55 + '_experimental'
56 + )
57 + ? 'process_artifacts_experimental'
58 + : 'process_artifacts';
59 const workflowID = buildMetadata.workflows.workflow_id;
60 const workflowMetadataURL = `https://circleci.com/api/v2/workflow/${workflowID}/jobs?circle-token=${
61 process.env.CIRCLE_CI_API_TOKEN
62 }`;
63 const workflowMetadata = await http.get(workflowMetadataURL, true);
64 const job = workflowMetadata.items.find(
61 - ({name}) => name === 'process_artifacts'
65 + ({name}) => name === artifactsJobName
66 );
67 if (!job || !job.job_number) {
68 console.log(
65 - theme`{error Could not find "process_artifacts" job for workflow ${workflowID}.}`
69 + theme`{error Could not find "${artifactsJobName}" job for workflow ${workflowID}.}`
70 );
71 process.exit(1);
72 }