Skip to content
Snippets Groups Projects
Unverified Commit 3c84667c authored by Michael Kriese's avatar Michael Kriese Committed by GitHub
Browse files

build: refactor release (#5691)

parent df70d30f
No related branches found
No related tags found
No related merge requests found
...@@ -82,5 +82,12 @@ module.exports = { ...@@ -82,5 +82,12 @@ module.exports = {
'@typescript-eslint/unbound-method': 0, '@typescript-eslint/unbound-method': 0,
}, },
}, },
{
files: ['**/*.mjs'],
rules: {
'@typescript-eslint/explicit-function-return-type': 0,
},
},
], ],
}; };
...@@ -40,6 +40,7 @@ jobs: ...@@ -40,6 +40,7 @@ jobs:
git config --global user.email 'bot@renovateapp.com' git config --global user.email 'bot@renovateapp.com'
git config --global user.name 'Renovate Bot' git config --global user.name 'Renovate Bot'
yarn config set version-git-tag false yarn config set version-git-tag false
echo '//registry.yarnpkg.com/:_authToken=${NPM_TOKEN}' > ~/.npmrc
echo "Node $(node --version)" echo "Node $(node --version)"
python --version python --version
echo "Yarn $(yarn --version)" echo "Yarn $(yarn --version)"
......
import got from 'got'; import got from 'got';
import shell from 'shelljs'; import shell from 'shelljs';
import program from './utils.mjs'; import { program } from './utils.mjs';
const version = program.release; const version = program.release;
const dry = program.dryRun; const dry = program.dryRun;
......
import shell from 'shelljs'; import shell from 'shelljs';
import program from './utils.mjs'; import { program, exec } from './utils.mjs';
const version = program.release; const version = program.release;
const sha = program.sha; const sha = program.sha;
const dry = program.dryRun;
let err = false; let err = false;
shell.echo(`Publishing version: ${version}`); shell.echo(`Publishing version: ${version}`);
try { shell.echo('Publishing docker images ...');
shell.echo('Publishing docker images ...'); err = err && !exec(`./.github/workflows/release-docker.sh ${version} ${sha}`);
if (!dry)
shell.exec(`./.github/workflows/release-docker.sh ${version} ${sha}`);
else shell.echo('dry-run done.');
} catch (e) {
shell.echo(e.toString());
err = true;
}
try { shell.echo('Publishing npm package ...');
shell.echo('Publishing npm package ...'); err =
if (!dry) err &&
shell.exec(`yarn publish --non-interactive --new-version ${version}`); !exec(`yarn publish --non-interactive --new-version ${version} --verbose`);
else shell.echo('dry-run done.');
} catch (e) {
shell.echo(e.toString());
err = true;
}
if (err) shell.exit(1); if (err) shell.exit(1);
import commander from 'commander'; import commander from 'commander';
import shell from 'shelljs';
const program = new commander.Command(); const program = new commander.Command();
program program
...@@ -9,4 +10,23 @@ program ...@@ -9,4 +10,23 @@ program
program.parse(process.argv); program.parse(process.argv);
export default program; export { program };
/**
* Executes a shell command
* @param cmd {string} The command to execute
* @returns {boolean} Returns true on zero exit code otherwise false
*/
export function exec(cmd) {
try {
if (!program.dryRun) {
const res = shell.exec(cmd);
return res.code === 0;
}
shell.echo(`DRY-RUN: ${cmd}`);
} catch (e) {
shell.echo(e.toString());
return false;
}
return true;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment