mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-20 10:21:37 +00:00
Merge pull request #148 from vitodeploy/versioning
show current version
This commit is contained in:
commit
bce05d3171
@ -1,10 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
namespace App\Http\Controllers\API;
|
||||
|
||||
use App\Actions\Site\Deploy;
|
||||
use App\Exceptions\SourceControlIsNotConnected;
|
||||
use App\Facades\Notifier;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\GitHook;
|
||||
use App\Models\ServerLog;
|
||||
use App\Notifications\SourceControlDisconnected;
|
16
app/Http/Controllers/API/HealthController.php
Normal file
16
app/Http/Controllers/API/HealthController.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\API;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class HealthController extends Controller
|
||||
{
|
||||
public function __invoke()
|
||||
{
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'version' => vito_version(),
|
||||
]);
|
||||
}
|
||||
}
|
@ -29,3 +29,8 @@ function htmx(): HtmxResponse
|
||||
{
|
||||
return new HtmxResponse();
|
||||
}
|
||||
|
||||
function vito_version(): string
|
||||
{
|
||||
return exec('git describe --tags');
|
||||
}
|
||||
|
@ -27,9 +27,9 @@ COPY docker/php.ini /etc/php/8.2/cli/conf.d/99-vito.ini
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# app
|
||||
COPY . /var/www/html
|
||||
RUN rm -rf /var/www/html/vendor
|
||||
RUN rm -rf /var/www/html/.env
|
||||
RUN rm -rf /var/www/html
|
||||
RUN git clone -b 1.x https://github.com/vitodeploy/vito.git /var/www/html
|
||||
RUN git checkout $(git tag -l --merged 1.x --sort=-v:refname | head -n 1)
|
||||
RUN composer install --no-dev --prefer-dist
|
||||
RUN chown -R www-data:www-data /var/www/html \
|
||||
&& chmod -R 755 /var/www/html/storage /var/www/html/bootstrap/cache
|
||||
|
File diff suppressed because one or more lines are too long
1
public/build/assets/app-e3775b0a.css
Normal file
1
public/build/assets/app-e3775b0a.css
Normal file
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"resources/css/app.css": {
|
||||
"file": "assets/app-2c6e7578.css",
|
||||
"file": "assets/app-e3775b0a.css",
|
||||
"isEntry": true,
|
||||
"src": "resources/css/app.css"
|
||||
},
|
||||
|
@ -1,26 +1,34 @@
|
||||
<nav
|
||||
class="fixed top-0 z-50 flex h-[64px] w-full items-center border-b border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800"
|
||||
>
|
||||
<div class="w-full px-3 py-3 lg:px-5 lg:pl-3">
|
||||
<div class="w-full">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center justify-start">
|
||||
<button
|
||||
data-drawer-target="logo-sidebar"
|
||||
data-drawer-toggle="logo-sidebar"
|
||||
aria-controls="logo-sidebar"
|
||||
type="button"
|
||||
class="inline-flex items-center rounded-md p-2 text-sm text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600 sm:hidden"
|
||||
<div
|
||||
class="flex items-center justify-start border-r border-gray-200 px-3 py-3 dark:border-gray-700 md:w-64"
|
||||
>
|
||||
<span class="sr-only">Open sidebar</span>
|
||||
<x-heroicon name="o-bars-3-center-left" class="h-6 w-6" />
|
||||
</button>
|
||||
<a href="/" class="ms-2 flex md:me-24">
|
||||
<div class="flex items-center justify-start text-3xl font-extrabold">
|
||||
<x-application-logo class="h-9 w-9 rounded-md" />
|
||||
<span class="ml-1 hidden sm:block">Deploy</span>
|
||||
</div>
|
||||
</a>
|
||||
<div class="h-[64px] w-1 border-r border-gray-200 px-3 dark:border-gray-700 md:px-0"></div>
|
||||
<button
|
||||
data-drawer-target="logo-sidebar"
|
||||
data-drawer-toggle="logo-sidebar"
|
||||
aria-controls="logo-sidebar"
|
||||
type="button"
|
||||
class="inline-flex items-center rounded-md p-2 text-sm text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600 sm:hidden"
|
||||
>
|
||||
<span class="sr-only">Open sidebar</span>
|
||||
<x-heroicon name="o-bars-3-center-left" class="h-6 w-6" />
|
||||
</button>
|
||||
<a href="/" class="ms-2 flex md:me-24">
|
||||
<div class="relative flex items-center justify-start text-3xl font-extrabold">
|
||||
<x-application-logo class="h-9 w-9 rounded-md" />
|
||||
<span class="ml-1 hidden md:block">Deploy</span>
|
||||
<span
|
||||
class="absolute bottom-0 left-0 right-0 rounded-b-md bg-gray-700/60 text-center text-xs text-white md:relative md:ml-1 md:block md:bg-inherit md:text-inherit"
|
||||
>
|
||||
{{ vito_version() }}
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="ml-5 cursor-pointer" x-data="">
|
||||
<div
|
||||
class="flex w-full items-center rounded-md border border-gray-200 bg-gray-100 px-4 py-2 text-sm text-gray-900 focus:ring-4 focus:ring-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300 dark:focus:ring-gray-600"
|
||||
@ -31,7 +39,7 @@ class="flex w-full items-center rounded-md border border-gray-200 bg-gray-100 px
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<div class="flex items-center px-3 py-3">
|
||||
<div class="mr-3">
|
||||
@include("layouts.partials.color-scheme")
|
||||
</div>
|
||||
|
@ -137,8 +137,8 @@
|
||||
x-on:click="close"
|
||||
class="fixed inset-0 bottom-0 left-0 right-0 top-0 z-[1000] items-center bg-gray-500 opacity-75 dark:bg-gray-900"
|
||||
></div>
|
||||
<div class="absolute z-[1000] mt-20 lg:scale-110">
|
||||
<div class="w-[500px]">
|
||||
<div class="absolute left-1 right-1 z-[1000] mt-20 md:left-auto md:right-auto lg:scale-110">
|
||||
<div class="w-full px-10 md:w-[500px]">
|
||||
<x-text-input
|
||||
id="search-input"
|
||||
x-ref="input"
|
||||
|
@ -1,7 +1,9 @@
|
||||
<?php
|
||||
|
||||
// git hook
|
||||
use App\Http\Controllers\GitHookController;
|
||||
use App\Http\Controllers\API\GitHookController;
|
||||
use App\Http\Controllers\API\HealthController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::any('git-hooks', GitHookController::class)->name('git-hooks');
|
||||
Route::get('health', HealthController::class)->name('api.health');
|
||||
Route::any('git-hooks', GitHookController::class)->name('api.git-hooks');
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
export VITO_VERSION="1.x"
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
export NEEDRESTART_MODE=a
|
||||
|
||||
@ -151,11 +152,13 @@ ln -s /etc/nginx/sites-available/vito /etc/nginx/sites-enabled/
|
||||
service nginx restart
|
||||
rm -rf /home/${V_USERNAME}/vito
|
||||
git config --global core.fileMode false
|
||||
git clone -b 1.x ${V_REPO} /home/${V_USERNAME}/vito
|
||||
git clone -b ${VITO_VERSION} ${V_REPO} /home/${V_USERNAME}/vito
|
||||
find /home/${V_USERNAME}/vito -type d -exec chmod 755 {} \;
|
||||
find /home/${V_USERNAME}/vito -type f -exec chmod 644 {} \;
|
||||
cd /home/${V_USERNAME}/vito && git config core.fileMode false
|
||||
cd /home/${V_USERNAME}/vito && composer install --no-dev
|
||||
cd /home/${V_USERNAME}/vito
|
||||
git checkout $(git tag -l --merged ${VITO_VERSION} --sort=-v:refname | head -n 1)
|
||||
composer install --no-dev
|
||||
cp .env.prod .env
|
||||
touch /home/${V_USERNAME}/vito/storage/database.sqlite
|
||||
php artisan key:generate
|
||||
|
@ -4,7 +4,9 @@ cd /home/vito/vito
|
||||
|
||||
php artisan down
|
||||
|
||||
git pull
|
||||
git fetch --all
|
||||
|
||||
git checkout $(git tag -l --merged 1.x --sort=-v:refname | head -n 1)
|
||||
|
||||
composer install --no-dev
|
||||
|
||||
|
@ -212,7 +212,7 @@ public function test_git_hook_deployment(): void
|
||||
'content' => 'git pull',
|
||||
]);
|
||||
|
||||
$this->post(route('git-hooks'), [
|
||||
$this->post(route('api.git-hooks'), [
|
||||
'secret' => 'secret',
|
||||
])->assertSessionDoesntHaveErrors();
|
||||
|
||||
@ -240,7 +240,7 @@ public function test_git_hook_deployment_invalid_secret(): void
|
||||
'content' => 'git pull',
|
||||
]);
|
||||
|
||||
$this->post(route('git-hooks'), [
|
||||
$this->post(route('api.git-hooks'), [
|
||||
'secret' => 'invalid-secret',
|
||||
])->assertNotFound();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user