mirror of
https://github.com/lone-cloud/gerbil
synced 2026-06-03 09:33:10 -07:00
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
#!/usr/bin/env tsx
|
|
|
|
import { execSync } from 'child_process';
|
|
import { readFileSync } from 'fs';
|
|
import { join } from 'path';
|
|
|
|
interface PackageJson {
|
|
version: string;
|
|
[key: string]: unknown;
|
|
}
|
|
|
|
const packageJson: PackageJson = JSON.parse(
|
|
readFileSync(join(__dirname, '..', 'package.json'), 'utf8')
|
|
);
|
|
const currentVersion = packageJson.version;
|
|
|
|
console.log(`Creating release for version ${currentVersion}...`);
|
|
|
|
try {
|
|
execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore' });
|
|
|
|
const gitStatus = execSync('git status --porcelain', { encoding: 'utf8' });
|
|
if (gitStatus.trim() !== '') {
|
|
console.error(
|
|
'Error: There are uncommitted changes. Please commit or stash them before creating a release.'
|
|
);
|
|
process.exit(1);
|
|
}
|
|
|
|
const tagName = `v${currentVersion}`;
|
|
console.log(`Creating tag ${tagName}...`);
|
|
|
|
execSync(`git tag ${tagName}`, { stdio: 'inherit' });
|
|
console.log(`Pushing tag ${tagName}...`);
|
|
|
|
execSync(`git push origin ${tagName}`, { stdio: 'inherit' });
|
|
|
|
console.log(`✅ Release ${tagName} created successfully!`);
|
|
console.log(`📦 GitHub Actions will now build and publish the release.`);
|
|
console.log(
|
|
`🔗 Check the progress at: https://github.com/lone-cloud/gerbil/actions`
|
|
);
|
|
} catch (error: unknown) {
|
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
console.error('❌ Error creating release:', errorMessage);
|
|
process.exit(1);
|
|
}
|