Skip to content

Commit

Permalink
Fix Build Fixed build path
Browse files Browse the repository at this point in the history
  • Loading branch information
Wtyd committed May 9, 2024
1 parent ab83048 commit 6602412
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
php --version
php githooks app:pre-build php
php githooks app:build
git status --short
- name: Upload build artifact
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion app/Commands/Zero/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private function build(string $name): BuildCommand
// $this->tarBuild($name);
// TODO la compilación bien pero falta mencionar el tar
$this->output->writeln(
sprintf(' Compiled successfully: <fg=green>%s</>', $this->build->getBuildPath() . DIRECTORY_SEPARATOR . $name)
sprintf(' Compiled successfully: <fg=green>%s</>', $this->build->getBuildPath() . $name)
);

return $this;
Expand Down
7 changes: 4 additions & 3 deletions src/Build/Build.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct()
*/
private function setPhpVersion(): void
{
$this->phpVersion = implode('.', array_slice(explode('.', phpversion()), 0, 2));
$this->phpVersion = phpversion();
}

/**
Expand All @@ -38,7 +38,7 @@ private function setPhpVersion(): void
private function setBuildPath(): void
{
$path = 'builds' . DIRECTORY_SEPARATOR;

// TODO: Refactor this to use a switch statement like getTarName()
if (version_compare($this->phpVersion, '7.1', '<')) {
throw new Exception('GitHooks only supports php 7.1 or greater.', 1);
}
Expand Down Expand Up @@ -67,7 +67,8 @@ public function getPhpVersion(): string
public function getTarName(): string
{
$tarName = '';
switch ($this->phpVersion) {

switch (implode('.', array_slice(explode('.', $this->phpVersion), 0, 2))) {
case '7.1':
case '7.2':
$tarName = 'githooks-7.1.tar';
Expand Down

0 comments on commit 6602412

Please sign in to comment.