This commit is contained in:
Bozhidar 2024-10-01 13:39:19 +03:00
parent 6218b9f602
commit 4ca4c7b04a
5 changed files with 15 additions and 3 deletions

View file

@ -105,14 +105,15 @@ class GitRepositoryResource extends Resource
}),
Tables\Actions\EditAction::make('deploy')
->label('Deploy')
Tables\Actions\EditAction::make('deployment_script')
->label('Deployment Script')
->icon('heroicon-o-command-line')
->form([
Forms\Components\Textarea::make('deployment_script')
->label('Deployment script')
->required()
->rows(15)
->helperText('Example: composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader')
->columnSpanFull(),
Forms\Components\Toggle::make('quick_deploy')
->label('Quick deploy')

View file

@ -40,6 +40,8 @@ class GitRepository extends Model
'dir',
'domain_id',
'git_ssh_key_id',
'deployment_script',
'quick_deploy'
];
/**
@ -164,6 +166,7 @@ class GitRepository extends Model
'projectDir' => $projectDir,
'privateKeyFile' => $privateKeyFile,
'selfFile' => $shellFile,
'deploymentScript'=>$this->deployment_script
])->render();
file_put_contents($shellFile, $shellContent);
@ -252,7 +255,7 @@ class GitRepository extends Model
'privateKeyFile' => $privateKeyFile,
'selfFile' => $shellFile,
])->render();
file_put_contents($shellFile, $shellContent);

View file

@ -14,4 +14,8 @@ git clone {{$cloneUrl}} {{$projectDir}}
@endif
@if($deploymentScript)
{!! $deploymentScript !!}
@endif
rm -rf {{$selfFile}}

View file

@ -14,4 +14,8 @@ git pull
@endif
@if($deploymentScript)
{!! $deploymentScript !!}
@endif
rm -rf {{$selfFile}}