Skip to content
This repository has been archived by the owner on Jan 26, 2025. It is now read-only.

Fix command #20

Merged
merged 8 commits into from
Jun 9, 2024
14 changes: 12 additions & 2 deletions src/Commands/InstallWorkflowCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,22 @@ public function __construct()

public function handle()
{
$source = resource_path('workflows/cpanel-auto-deploy.yml.stub');
// Adjust the source path to be relative to the package's base directory
$source = __DIR__.'/../../resources/workflows/cpanel-auto-deploy.yml.stub';
$destination = base_path('.github/workflows/cpanel-auto-deploy.yml');

// Check if source file exists
if (! File::exists($source)) {
$this->error('Source file does not exist: '.$source);

return 1;
}

$directory = dirname($destination);
if (! File::exists($directory)) {
File::makeDirectory($directory);
if (! File::makeDirectory($directory, 0755, true)) {
$this->error('Failed to create directories: '.$directory);
}
}

if (File::copy($source, $destination)) {
Expand Down
Loading