Skip to content

Commit 8207e9c

Browse files
authored
ci(0.79): only create .rnm-publish sentinel file if versioning happened (microsoft#2683)
Backport microsoft#2682
1 parent 02d17df commit 8207e9c

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

nx.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@
2121
"versionActionsOptions": {
2222
"currentVersionResolver": "registry",
2323
"currentVersionResolverMetadata": {
24-
"tag": "next"
25-
},
26-
"preid": "rc"
24+
"tag": "latest"
25+
}
2726
},
2827
"useLegacyVersioning": false
2928
}

packages/nx-release-version/index.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,25 @@ const afterAllProjectsVersioned = async (cwd, opts) => {
7979
const changedFiles = [...baseResult.changedFiles];
8080
const deletedFiles = [...baseResult.deletedFiles];
8181

82-
try {
83-
// Create the .rnm-publish file to indicate versioning has occurred
84-
fs.writeFileSync(path.join(REPO_ROOT, '.rnm-publish'), '');
82+
// Only update React Native artifacts if versioning actually happened
83+
if (changedFiles.length > 0) {
84+
try {
85+
// Create the .rnm-publish file to indicate versioning has occurred
86+
fs.writeFileSync(path.join(REPO_ROOT, '.rnm-publish'), '');
8587

86-
// Update React Native artifacts
87-
const versionedFiles = await runSetVersion();
88+
// Update React Native artifacts
89+
const versionedFiles = await runSetVersion();
8890

89-
// Add the versioned files to changed files
90-
changedFiles.push(...versionedFiles);
91+
// Add the versioned files to changed files
92+
changedFiles.push(...versionedFiles);
9193

92-
console.log('✅ Updated React Native artifacts');
93-
console.table(versionedFiles.map(file => path.relative(REPO_ROOT, file)));
94-
} catch (error) {
95-
const errorMessage = error instanceof Error ? error.message : String(error);
96-
console.error(`❌ Failed to update React Native artifacts: ${errorMessage}`);
97-
throw error;
94+
console.log('✅ Updated React Native artifacts');
95+
console.table(versionedFiles.map(file => path.relative(REPO_ROOT, file)));
96+
} catch (error) {
97+
const errorMessage = error instanceof Error ? error.message : String(error);
98+
console.error(`❌ Failed to update React Native artifacts: ${errorMessage}`);
99+
throw error;
100+
}
98101
}
99102

100103
return {

0 commit comments

Comments
 (0)