mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add librenms command (#9619)
* Add librenms command Hook up to artisan. Hide dev commands and most other commands if app environment is production. Register all commands for php artisan or when not in production. * remove dead end line * Console application name and version. Had to shift some stuff from legacy code, but deferred others as it was too extensive of a change. * switch check order * always get local version now * update array format * whitepace * fix style
This commit is contained in:
37
routes/dev-console.php
Normal file
37
routes/dev-console.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use LibreNMS\Util\GitHub;
|
||||
|
||||
Artisan::command('release:tag
|
||||
{tag : The new tag / version}
|
||||
{from : The previous tag / version}
|
||||
{--file= : The filename to update}
|
||||
{--pr= : The last PR to include in this release if not master branch}', function () {
|
||||
$tag = $this->argument('tag');
|
||||
$this->info("Creating release $tag.....");
|
||||
try {
|
||||
$gh = new GitHub(
|
||||
$tag,
|
||||
$this->argument('from'),
|
||||
$this->option('file') ?: 'doc/General/Changelog.md',
|
||||
getenv('GH_TOKEN') ?: $this->secret('Enter a GitHub Token?'),
|
||||
$this->option('pr')
|
||||
);
|
||||
$gh->createChangelog();
|
||||
$this->info("Changelog generated for $tag");
|
||||
|
||||
if ($this->confirm('Do you want to view the generated Changelog?')) {
|
||||
echo $gh->getMarkdown();
|
||||
}
|
||||
|
||||
if ($this->confirm("Do you want to create the release $tag on GitHub?")) {
|
||||
if ($gh->createRelease()) {
|
||||
$this->info('Release created.');
|
||||
} else {
|
||||
$this->error('Failed to create release, check github to see what was completed.');
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
})->describe('Create a new LibreNMS release including changelog');
|
Reference in New Issue
Block a user