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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: catheadtab-extension
path: frontend/catheadtab-*.zip
path: frontend/release/catheadtab-*.zip
retention-days: 7

release:
Expand Down
16 changes: 14 additions & 2 deletions frontend/scripts/release.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,23 @@ if (!changelog.some((e) => e.version === version)) {
console.warn(`\n⚠️ changelog.json has no entry for ${version}. Add one before releasing for proper release notes.`);
}

// 5. Commit, tag, and push (pushing the tag triggers CI to build + release).
// 5. Build the extension zip locally (release/catheadtab-v<version>.zip).
// Building before commit/tag means a broken build aborts the release before
// anything is published; roll back the bump so the tree is clean for a retry.
console.log(`\n📦 Building extension zip for ${tag}...\n`);
try {
run('npm run build:ext');
} catch {
run('git checkout -- package.json package-lock.json public/manifest.json');
console.error('\n❌ build:ext failed — version bump rolled back, nothing committed or pushed.');
process.exit(1);
}

// 6. Commit, tag, and push (pushing the tag triggers CI to build + release).
console.log(`\n🚀 Releasing ${tag}\n`);
run('git add package.json package-lock.json public/manifest.json');
run(`git commit -m "chore: release ${tag}"`);
run(`git tag -a ${tag} -m "chore: release ${tag}"`);
run('git push --follow-tags');

console.log(`\n🎉 Pushed ${tag}. CI will build the zip and create the GitHub Release.`);
console.log(`\n🎉 Pushed ${tag}. Local zip: release/catheadtab-${tag.slice(1)}.zip — CI will build the same and create the GitHub Release.`);
9 changes: 6 additions & 3 deletions frontend/scripts/zip.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,12 @@ if (fs.existsSync(distManifestPath)) {
fs.writeFileSync(distManifestPath, JSON.stringify(distManifest, null, 2));
}

// Define output file
// Define output file — zips land in release/ (gitignored) so the repo root
// stays clean and local builds match where the user keeps release artifacts.
const releaseDir = path.join(frontendDir, 'release');
fs.mkdirSync(releaseDir, { recursive: true });
const outputFileName = `catheadtab-v${version}.zip`;
const outputPath = path.join(frontendDir, outputFileName);
const outputPath = path.join(releaseDir, outputFileName);

console.log(`Starting to create zip file: ${outputFileName}...`);

Expand All @@ -74,7 +77,7 @@ const archive = archiver('zip', {

// Listen for all archive data to be written
output.on('close', function() {
console.log(`Successfully created ${outputFileName} (${archive.pointer()} bytes)`);
console.log(`Successfully created release/${outputFileName} (${archive.pointer()} bytes)`);
console.log('Ready to upload to Chrome Web Store!');
});

Expand Down
Loading