mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
bfc841d71d
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52512 The way Maven works is that the artifacts are uploaded and available way before the browsing UI will allow us to browse them. By trying to download the `.pom` file instead of checking for the browsing website to be visible, we can shave some minutes during the release ## Changelog: [Internal] - Reviewed By: cortinico Differential Revision: D78008635 fbshipit-source-id: 96516163628d6d25db385d996a11b4af78db764a
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
const {log, sleep} = require('./utils');
|
|
|
|
const SLEEP_S = 60; // 1 minute
|
|
const MAX_RETRIES = 90; // 90 attempts. Waiting between attempt: 1 min. Total time: 90 min.
|
|
const ARTIFACT_URL =
|
|
'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/';
|
|
const ARTIFACT_NAME = 'react-native-artifacts-';
|
|
|
|
async function verifyArtifactsAreOnMaven(version, retries = MAX_RETRIES) {
|
|
if (version.startsWith('v')) {
|
|
version = version.substring(1);
|
|
}
|
|
|
|
const artifactUrl = `${ARTIFACT_URL}${version}/${ARTIFACT_NAME}${version}.pom`;
|
|
for (let currentAttempt = 1; currentAttempt <= retries; currentAttempt++) {
|
|
const response = await fetch(artifactUrl);
|
|
|
|
if (response.status !== 200) {
|
|
log(
|
|
`${currentAttempt}) Artifact's for version ${version} are not on maven yet.\nURL: ${artifactUrl}\nLet's wait a minute and try again.\n`,
|
|
);
|
|
await sleep(SLEEP_S);
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
|
|
log(
|
|
`We waited 90 minutes for the artifacts to be on Maven. Check https://status.maven.org/ if there are issues wth the service.`,
|
|
);
|
|
process.exit(1);
|
|
}
|
|
|
|
module.exports = {verifyArtifactsAreOnMaven};
|