-
Notifications
You must be signed in to change notification settings - Fork 25
GitHub auto release #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/Command/GithubReleaseCommand.php
Outdated
$dotenv = new Dotenv(); | ||
$dotenv->load(__DIR__.'/../../.env'); | ||
|
||
if (empty($_ENV['GITHUB_API_TOKEN'])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some edge-case reason, I'm told we should use $_SERVER
for env vars :)
src/Command/GithubReleaseCommand.php
Outdated
use Symfony\Component\Process\Process; | ||
use Symfony\Contracts\HttpClient\HttpClientInterface; | ||
|
||
class GithubReleaseCommand extends Command |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a command to release a command-line library feels weird to me - there's no reason, for example, that this should even been accessible when you're working with the phar file. Could we make this a flat bin/create_release
file? We would still require the autoloader... and then probably we could refactor some of the code into "service classes" that are used in that script (so that the script is ultimately tiny). We could then not include this script nor those supporting classes in the phar file.
src/Command/GithubReleaseCommand.php
Outdated
$this->client = $this->createHttpClient($_ENV['GITHUB_API_TOKEN']); | ||
|
||
$tag = $input->getArgument('tag'); | ||
if (!preg_match('/^v\d+\.\d+\.\d+$/', $tag)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for a sanity check!
src/Command/GithubReleaseCommand.php
Outdated
$message = 'Maybe the tag name already exists?'; | ||
} | ||
|
||
throw new RuntimeException(sprintf('Error while trying to create release: %s.', $message), 0, $exception); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
src/Command/GithubReleaseCommand.php
Outdated
'target_commitish' => 'master', | ||
'name' => $this->name, | ||
'description' => $this->description, | ||
'draft' => false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Could we set this draft
=> true, then upload the asset, then modify it to draft=>false
? That's minor... but it would eliminate any time when the release is published and has no phar attached.
composer.json
Outdated
"twig/twig": "^2.7.3" | ||
"twig/twig": "^2.7.3", | ||
"symfony/http-client": "^4.3", | ||
"symfony/dotenv": "^4.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to require-dev
fc65e19
to
a2892cd
Compare
a2892cd
to
cbe535d
Compare
No description provided.