chore(ci): remove unused release script (#5874)
This commit is contained in:
parent
2d821700bd
commit
89e2033556
@ -199,7 +199,6 @@
|
||||
"flush-promises": "^1.0.2",
|
||||
"glob": "^8.0.3",
|
||||
"husky": "^7.0.4",
|
||||
"inquirer": "^8.0.0",
|
||||
"jest": "29.4.3",
|
||||
"jest-canvas-mock": "^2.3.1",
|
||||
"jest-environment-jsdom": "^29.4.1",
|
||||
|
@ -1,82 +0,0 @@
|
||||
const { execSync } = require('child_process');
|
||||
const inquirer = require('inquirer');
|
||||
|
||||
const getTags = (take) => {
|
||||
const tags = execSync(
|
||||
"git for-each-ref --sort=taggerdate --format '%(refname)' refs/tags"
|
||||
)
|
||||
.toString()
|
||||
.trim()
|
||||
.split('\n')
|
||||
.map((t) => t.replace('refs/tags/', ''))
|
||||
.reverse()
|
||||
.slice(0, take);
|
||||
return tags;
|
||||
};
|
||||
|
||||
const getReleaseBranches = () => {
|
||||
const branches = execSync('git branch --remote | grep origin/release/')
|
||||
.toString()
|
||||
.trim()
|
||||
.split('\n')
|
||||
.map((b) => b.trim().replace('origin/release/', ''));
|
||||
return branches;
|
||||
};
|
||||
|
||||
const release = (tag, branch) => {
|
||||
const steps = [
|
||||
`git checkout ${branch}`,
|
||||
'git pull',
|
||||
`git reset --hard ${tag}`,
|
||||
'git push --force',
|
||||
];
|
||||
try {
|
||||
for (const cmd of steps) {
|
||||
const result = execSync(cmd).toString();
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Could not make a release');
|
||||
}
|
||||
};
|
||||
|
||||
inquirer
|
||||
.prompt([
|
||||
{
|
||||
type: 'list',
|
||||
name: 'tag',
|
||||
message: 'What version would you like to release?',
|
||||
choices: getTags(),
|
||||
},
|
||||
{
|
||||
type: 'checkbox',
|
||||
name: 'envs',
|
||||
message: 'To what environment you wish to release?',
|
||||
choices: ['mainnet', ...getReleaseBranches()],
|
||||
validate(answer) {
|
||||
return answer.length > 0;
|
||||
},
|
||||
},
|
||||
])
|
||||
.then((answers) => {
|
||||
inquirer
|
||||
.prompt({
|
||||
type: 'confirm',
|
||||
name: 'sure',
|
||||
message: `Are you sure? This will release ${
|
||||
answers.tag
|
||||
} to ${answers.envs.join(', ')}`,
|
||||
})
|
||||
.then(() => {
|
||||
for (const env of answers.envs) {
|
||||
const branch = env === 'mainnet' ? 'main' : `release/${env}`;
|
||||
release(answers.tag, branch);
|
||||
}
|
||||
execSync('git checkout develop');
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log('Something went wrong', err.toString());
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log('Something went wrong', err.toString());
|
||||
});
|
Loading…
Reference in New Issue
Block a user