Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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, [
Expand Down Expand Up @@ -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}`);
Expand All @@ -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;
Expand All @@ -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}`);
Expand Down
15 changes: 0 additions & 15 deletions examples/rsbuild-demo2/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,6 @@ const App = () => {
<p>Full support for React 18+ with concurrent features.</p>
</div>
</div>

<div className="info-section">
<div className="feature-card">
<h3>Fast Build</h3>
<p>Rsbuild provides lightning-fast build times with modern tooling.</p>
</div>
<div className="feature-card">
<h3>TypeScript Support</h3>
<p>Built-in TypeScript support with excellent developer experience.</p>
</div>
<div className="feature-card">
<h3>Modern React</h3>
<p>Full support for React 18+ with concurrent features.</p>
</div>
</div>

<div className="stats-container">
<div className="stat-item">
Expand Down
10 changes: 6 additions & 4 deletions src/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
13 changes: 6 additions & 7 deletions src/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down