Files
Riccardo Cipolleschi 60fac2e14d Fix post-release workflow failures (#57627)
Summary:
Fixes the three post-release failures from the [0.87.0-rc.2 publish run](https://github.com/react/react-native/actions/runs/29775529785/):

- Keep Flow annotations in `verifyArtifactsAreOnMaven.js` as comments so `actions/github-script` can load the file with plain Node.
- Pin the Podfile lock workflow to `macos-15`, which provides the configured Xcode 16.4 version.
- Use the canonical `react/react-native` owner for release asset API operations so upload POST requests are not redirected from the former owner.

## Changelog:

[INTERNAL] [FIXED] - Fix post-release Maven verification, Podfile lock, and release asset jobs

Pull Request resolved: https://github.com/react/react-native/pull/57627

Test Plan:
```sh
node --check .github/workflow-scripts/verifyArtifactsAreOnMaven.js
node --check scripts/releases/upload-release-assets-for-dotslash.js
yarn jest .github/workflow-scripts/__tests__/verifyArtifactsAreOnMaven-test.js scripts/releases/__tests__/upload-release-assets-for-dotslash-test.js --runInBand
```

13 tests and 15 snapshots pass.

Reviewed By: zeyap

Differential Revision: D113032768

Pulled By: cipolleschi

fbshipit-source-id: df5f493603e6c25157fd7660b54aa409dcb742e7
2026-07-21 09:31:58 -07:00

86 lines
2.7 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
*/
// @flow
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-';
// The primary xcframework classifier tarballs attached to the
// react-native-artifacts publication (external-artifacts/build.gradle.kts).
// The 4 dSYM classifiers (core/deps dSYM debug+release) are intentionally
// excluded — they are debug-symbol sidecars, not consumed at install time.
// The POM check alone would pass even when a classifier artifact never made
// it to Maven.
const ARTIFACT_CLASSIFIERS = [
'reactnative-core-debug',
'reactnative-core-release',
'reactnative-dependencies-debug',
'reactnative-dependencies-release',
'reactnative-headers-debug',
'reactnative-headers-release',
'reactnative-dependencies-headers-debug',
'reactnative-dependencies-headers-release',
];
async function verifyArtifactsAreOnMaven(
version /*: string */,
retries /*: number */ = MAX_RETRIES,
) /*: Promise<void> */ {
if (version.startsWith('v')) {
version = version.substring(1);
}
const urls = [
`${ARTIFACT_URL}${version}/${ARTIFACT_NAME}${version}.pom`,
...ARTIFACT_CLASSIFIERS.map(
classifier =>
`${ARTIFACT_URL}${version}/${ARTIFACT_NAME}${version}-${classifier}.tar.gz`,
),
];
for (let currentAttempt = 1; currentAttempt <= retries; currentAttempt++) {
let missingUrl = null;
for (const url of urls) {
try {
const response = await fetch(url, {method: 'HEAD'});
if (response.status === 200) {
continue;
}
log(`Got status ${response.status} while checking ${url}`);
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
log(`Network error while checking ${url}: ${message}`);
missingUrl = url;
break;
}
missingUrl = url;
break;
}
if (missingUrl == null) {
return;
}
log(
`${currentAttempt}) Artifact's for version ${version} are not on maven yet.\nURL: ${missingUrl}\nLet's wait a minute and try again.\n`,
);
await sleep(SLEEP_S);
}
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};