mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
feat: add pre-checks to release-all script for safety
Add validation checks before releasing: - Ensure we're on the main branch to prevent accidental releases from feature branches - Verify npm authentication to prevent failed publish attempts This prevents common release mistakes and improves release workflow reliability.
This commit is contained in:
+6
-6
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@twsxtd/hapi",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"description": "App for agentic coding - access coding agent anywhere",
|
||||
"author": "Kirill Dubovitskiy & weishu",
|
||||
"license": "MIT",
|
||||
@@ -25,11 +25,11 @@
|
||||
}
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@twsxtd/hapi-darwin-arm64": "0.1.0",
|
||||
"@twsxtd/hapi-darwin-x64": "0.1.0",
|
||||
"@twsxtd/hapi-linux-arm64": "0.1.0",
|
||||
"@twsxtd/hapi-linux-x64": "0.1.0",
|
||||
"@twsxtd/hapi-win32-x64": "0.1.0"
|
||||
"@twsxtd/hapi-darwin-arm64": "0.1.1",
|
||||
"@twsxtd/hapi-darwin-x64": "0.1.1",
|
||||
"@twsxtd/hapi-linux-arm64": "0.1.1",
|
||||
"@twsxtd/hapi-linux-x64": "0.1.1",
|
||||
"@twsxtd/hapi-win32-x64": "0.1.1"
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit",
|
||||
|
||||
@@ -45,6 +45,24 @@ async function main(): Promise<void> {
|
||||
const flags = [dryRun && 'dry-run', publishNpm && 'publish-npm', skipBuild && 'skip-build'].filter(Boolean);
|
||||
console.log(`\n🚀 Starting release v${version}${flags.length ? ` (${flags.join(', ')})` : ''}\n`);
|
||||
|
||||
// Pre-check: Ensure we're on main branch
|
||||
console.log('🔍 Pre-checks...');
|
||||
const currentBranch = execSync('git branch --show-current', { encoding: 'utf-8', cwd: repoRoot }).trim();
|
||||
if (currentBranch !== 'main') {
|
||||
console.error(`❌ Release must be run from main branch (current: ${currentBranch})`);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(' ✓ On main branch');
|
||||
|
||||
// Pre-check: Ensure npm is logged in
|
||||
try {
|
||||
const npmUser = execSync('npm whoami', { encoding: 'utf-8' }).trim();
|
||||
console.log(` ✓ Logged in to npm as: ${npmUser}`);
|
||||
} catch {
|
||||
console.error('❌ Not logged in to npm. Run `npm login` first.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Step 1: Update package.json version
|
||||
console.log('📦 Step 1: Updating package.json version...');
|
||||
const pkgPath = join(projectRoot, 'package.json');
|
||||
|
||||
Reference in New Issue
Block a user