#feature: Jenkins 构建入口与自动创建 release 分支
加入 crm-web/crm-opm 并可跳转 Jenkins 发布页;自动创建 release 时 commit 使用 release-版本号,并跳过本地 git hook,避免 agent-be 被拦下。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Project;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasTable('projects')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$projects = [
|
||||
[
|
||||
'slug' => 'crm-web',
|
||||
'name' => 'Crm web',
|
||||
'directory' => 'crm-web',
|
||||
'jenkins_job_name' => 'crm-dev-crm_web',
|
||||
],
|
||||
[
|
||||
'slug' => 'crm-opm',
|
||||
'name' => 'Crm opm',
|
||||
'directory' => 'crm-opm',
|
||||
'jenkins_job_name' => 'crm-dev-crm_opm',
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($projects as $data) {
|
||||
$project = Project::query()->firstOrCreate(
|
||||
['slug' => $data['slug']],
|
||||
[
|
||||
'name' => $data['name'],
|
||||
'directory' => $data['directory'],
|
||||
]
|
||||
);
|
||||
|
||||
$project->update([
|
||||
'jenkins_job_name' => $data['jenkins_job_name'],
|
||||
'jenkins_notify_enabled' => true,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (! Schema::hasTable('projects')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Project::query()
|
||||
->whereIn('slug', ['crm-web', 'crm-opm'])
|
||||
->whereIn('jenkins_job_name', ['crm-dev-crm_web', 'crm-dev-crm_opm'])
|
||||
->delete();
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user