Added autodeploy
This commit is contained in:
parent
25323b4cef
commit
9e8bdd30d9
30
.github/workflows/deploy.yml
vendored
Normal file
30
.github/workflows/deploy.yml
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
name: deploy
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
|
||||
concurrency: production_environment
|
||||
|
||||
jobs:
|
||||
production:
|
||||
runs-on: ubuntu-latest
|
||||
environment: Production
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: "8.2"
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --no-interaction --no-scripts --prefer-dist --no-dev
|
||||
|
||||
|
||||
- name: Deploy
|
||||
uses: deployphp/action@v1
|
||||
with:
|
||||
private-key: ${{ secrets.DEPLOY_KEY }}
|
||||
dep: deploy production --tag=${{ githib.ref }}
|
||||
43
deploy.php
Normal file
43
deploy.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Deployer;
|
||||
|
||||
require 'recipe/laravel.php';
|
||||
require 'contrib/npm.php';
|
||||
|
||||
// Config
|
||||
|
||||
set('git_ssh_command', 'ssh');
|
||||
set('repository', 'git@ssh.git.lovelynet.net:9001/PriceyBot/PriceyBotPanel.git');
|
||||
|
||||
add('shared_files', []);
|
||||
add('shared_dirs', []);
|
||||
add('writable_dirs', []);
|
||||
|
||||
set('http_user', 'nginx');
|
||||
set('http_group', 'nginx');
|
||||
set('writable_mode', 'chmod');
|
||||
|
||||
// Hosts
|
||||
host('production')
|
||||
->set('hostname', 'vps.benjamyn.love')
|
||||
->set('port', '22')
|
||||
->set('remote_user', 'root')
|
||||
->set('deploy_path'), '/opt/PriceyBotPanel');
|
||||
|
||||
|
||||
// Tasks
|
||||
task('npm:build', function () {
|
||||
$command = match (get('alias')) {
|
||||
'production' => 'production',
|
||||
'staging' => 'development',
|
||||
default => 'production'
|
||||
};
|
||||
|
||||
run("cd {{release_path}} && {{bin/npm}} run {$command}");
|
||||
});
|
||||
|
||||
// Hooks
|
||||
after('deploy:vendors', 'npm:install');
|
||||
after('npm:install', 'npm:build');
|
||||
after('deploy:failed', 'deploy:unlock');
|
||||
Reference in New Issue
Block a user