diff --git a/dist/index.js b/dist/index.js index 93f153b..5b288d1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -16019,13 +16019,13 @@ The following characters are not allowed in files that are uploaded due to limit listEnumValues: ()=>listEnumValues, assertNever: ()=>assert.xb, mergeBinaryOptions: ()=>binary_format_contract.Ix, - reflectionScalarDefault: ()=>reflectionScalarDefault, lowerCamelCase: ()=>lower_camel_case.W, PbULong: ()=>PbULong, LongType: ()=>reflection_info_LongType, MessageType: ()=>MessageType, ScalarType: ()=>reflection_info_ScalarType, readFieldOptions: ()=>readFieldOptions, + reflectionScalarDefault: ()=>reflectionScalarDefault, WireType: ()=>binary_format_contract.O0, containsMessageType: ()=>containsMessageType, listEnumNumbers: ()=>listEnumNumbers, @@ -95662,9 +95662,8 @@ var __webpack_exports__ = {}; const relativePath = external_path_default().relative(process.cwd(), targetFilePath); const pathParts = relativePath.split(external_path_default().sep); const fileNameWithoutExt = external_path_default().parse(fileName).name; - const fileExt = external_path_default().parse(fileName).ext; const pathHash = hashPath(pathParts, fileNameWithoutExt); - const artifactName = `${pathHash}-${hash}${fileExt}`; + const artifactName = `${pathHash}-${hash}`; console.log(`Uploading artifact: ${artifactName}`); console.log(`From file: ${targetFilePath}`); const uploadResponse = await artifactClient.uploadArtifact(artifactName, [ @@ -96132,7 +96131,8 @@ var __webpack_exports__ = {}; const fileNameWithoutExt = external_path_default().parse(fileName).name; const fileExt = external_path_default().parse(fileName).ext; const pathHash = hashPath(pathParts, fileNameWithoutExt); - const expectedArtifactName = `${pathHash}-${commitHash}${fileExt}`; + const expectedArtifactName = `${pathHash}-${commitHash}`; + const legacyArtifactName = `${pathHash}-${commitHash}${fileExt}`; console.log(`📋 Searching for artifact with path hash and commit hash: ${expectedArtifactName}`); console.log(` Path hash: ${pathHash}`); console.log(` File path: ${relativePath}`); @@ -96147,7 +96147,7 @@ var __webpack_exports__ = {}; console.log(` Status: ${workflowRun.status}, Conclusion: ${workflowRun.conclusion}`); try { const runArtifacts = await githubService.listArtifactsForWorkflowRun(workflowRun.id); - const foundArtifact = runArtifacts.artifacts?.find((a)=>a.name === expectedArtifactName); + const foundArtifact = runArtifacts.artifacts?.find((a)=>a.name === expectedArtifactName || a.name === legacyArtifactName); if (foundArtifact) { artifact = foundArtifact; artifacts = runArtifacts; @@ -96173,7 +96173,7 @@ var __webpack_exports__ = {}; } if (!artifact) { artifacts = await githubService.listArtifacts(); - artifact = artifacts.artifacts.find((a)=>a.name === expectedArtifactName); + artifact = artifacts.artifacts.find((a)=>a.name === expectedArtifactName || a.name === legacyArtifactName); } if (!artifact) { console.log(`❌ No artifact found matching: ${expectedArtifactName}`); diff --git a/examples/rsbuild-demo2/src/App.tsx b/examples/rsbuild-demo2/src/App.tsx index bfaada1..5d971e8 100644 --- a/examples/rsbuild-demo2/src/App.tsx +++ b/examples/rsbuild-demo2/src/App.tsx @@ -38,21 +38,6 @@ const App = () => {

Full support for React 18+ with concurrent features.

- -
-
-

Fast Build

-

Rsbuild provides lightning-fast build times with modern tooling.

-
-
-

TypeScript Support

-

Built-in TypeScript support with excellent developer experience.

-
-
-

Modern React

-

Full support for React 18+ with concurrent features.

-
-
diff --git a/src/download.ts b/src/download.ts index 413b0d0..e12d5e1 100644 --- a/src/download.ts +++ b/src/download.ts @@ -106,8 +106,10 @@ export async function downloadArtifactByCommitHash( const fileNameWithoutExt = path.parse(fileName).name; const fileExt = path.parse(fileName).ext; const pathHash = hashPath(pathParts, fileNameWithoutExt); - const expectedArtifactName = `${pathHash}-${commitHash}${fileExt}`; - + // New format (no extension); legacy format includes the file extension + const expectedArtifactName = `${pathHash}-${commitHash}`; + const legacyArtifactName = `${pathHash}-${commitHash}${fileExt}`; + console.log(`📋 Searching for artifact with path hash and commit hash: ${expectedArtifactName}`); console.log(` Path hash: ${pathHash}`); console.log(` File path: ${relativePath}`); @@ -129,7 +131,7 @@ export async function downloadArtifactByCommitHash( try { const runArtifacts = await githubService.listArtifactsForWorkflowRun(workflowRun.id); - const foundArtifact = runArtifacts.artifacts?.find((a: any) => a.name === expectedArtifactName); + const foundArtifact = runArtifacts.artifacts?.find((a: any) => a.name === expectedArtifactName || a.name === legacyArtifactName); if (foundArtifact) { artifact = foundArtifact; @@ -158,7 +160,7 @@ export async function downloadArtifactByCommitHash( // Fallback: if not found in any workflow run, search all repository artifacts if (!artifact) { artifacts = await githubService.listArtifacts(); - artifact = artifacts.artifacts.find((a: any) => a.name === expectedArtifactName); + artifact = artifacts.artifacts.find((a: any) => a.name === expectedArtifactName || a.name === legacyArtifactName); } if (!artifact) { diff --git a/src/upload.ts b/src/upload.ts index 17f483b..1625123 100644 --- a/src/upload.ts +++ b/src/upload.ts @@ -11,23 +11,22 @@ export function hashPath(pathParts: string[], fileNameWithoutExt: string): strin export async function uploadArtifact(filePath: string, commitHash?: string) { const artifactClient = new DefaultArtifactClient(); - + const hash = commitHash || execSync('git rev-parse --short=10 HEAD', { encoding: 'utf8' }).trim(); - + const targetFilePath = filePath; - + if (!targetFilePath || !fs.existsSync(targetFilePath)) { throw new Error(`Target file not found: ${targetFilePath}`); } const fileName = path.basename(targetFilePath); - + const relativePath = path.relative(process.cwd(), targetFilePath); const pathParts = relativePath.split(path.sep); const fileNameWithoutExt = path.parse(fileName).name; - const fileExt = path.parse(fileName).ext; - + const pathHash = hashPath(pathParts, fileNameWithoutExt); - const artifactName = `${pathHash}-${hash}${fileExt}`; + const artifactName = `${pathHash}-${hash}`; console.log(`Uploading artifact: ${artifactName}`); console.log(`From file: ${targetFilePath}`);