ci: semantic-release automation for tag/changelog (Option D)
Закрывает эту тему окончательно. После merge в main CI анализирует conventional commits с последнего tag'а, бампит package.json + CHANGELOG.md и пушит git tag vX.Y.Z. Tag pipeline далее собирает images и ждёт manual gate на trigger-deploy-prod. Что добавил: - ordinis-admin-ui/.releaserc.json — config (commit-analyzer, release-notes, changelog, npm[no-publish], git, gitlab). branches: ['main']. Маппинг conventional-commit types к bump levels. - ordinis-admin-ui/package.json — devDeps: semantic-release@24.2 + 6 plugins. - .gitlab-ci.yml — new 'release' stage + release job: - needs: trigger-deploy-staging (release ТОЛЬКО после зелёного staging) - image: node:22-alpine + pnpm@9.15.4 - GL_TOKEN из CI variable GITLAB_TOKEN (semantic-release/gitlab требует именно GL_TOKEN env name) - allow_failure: true (нет релизных commits = OK, не блокирует pipeline) - RELEASE.md — operator docs: - One-time setup: создать Project Access Token + GITLAB_TOKEN CI var - Commit conventions table (feat→minor, fix→patch, breaking→major) - Skip release (use chore: type или [skip ci]) - Dry-run command для local validation Prod safety: trigger-deploy-prod остаётся manual (when: manual). Автоматизация ТОЛЬКО tag-создания, не deploy. Tag → CI runs → human кликает Deploy. ACTION REQUIRED от user (one-time): 1. GitLab → Settings → Access Tokens → создать Project Access Token scopes: write_repository + api, role: Maintainer 2. GitLab → Settings → CI/CD → Variables → GITLAB_TOKEN (Masked, Protected) Без этого release job будет fail'ить (но pipeline не покраснеет — allow_failure).
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"branches": ["main"],
|
||||
"tagFormat": "v${version}",
|
||||
"plugins": [
|
||||
[
|
||||
"@semantic-release/commit-analyzer",
|
||||
{
|
||||
"preset": "conventionalcommits",
|
||||
"releaseRules": [
|
||||
{ "type": "feat", "release": "minor" },
|
||||
{ "type": "fix", "release": "patch" },
|
||||
{ "type": "perf", "release": "patch" },
|
||||
{ "type": "refactor", "release": "patch" },
|
||||
{ "type": "revert", "release": "patch" },
|
||||
{ "type": "docs", "release": false },
|
||||
{ "type": "style", "release": false },
|
||||
{ "type": "chore", "release": false },
|
||||
{ "type": "test", "release": false },
|
||||
{ "type": "build", "release": false },
|
||||
{ "type": "ci", "release": false },
|
||||
{ "breaking": true, "release": "major" }
|
||||
],
|
||||
"parserOpts": {
|
||||
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
|
||||
}
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/release-notes-generator",
|
||||
{
|
||||
"preset": "conventionalcommits",
|
||||
"presetConfig": {
|
||||
"types": [
|
||||
{ "type": "feat", "section": "✨ Features" },
|
||||
{ "type": "fix", "section": "🐛 Fixes" },
|
||||
{ "type": "perf", "section": "⚡ Performance" },
|
||||
{ "type": "refactor", "section": "♻️ Refactoring" },
|
||||
{ "type": "revert", "section": "⏪ Reverts" },
|
||||
{ "type": "docs", "section": "📝 Docs", "hidden": false },
|
||||
{ "type": "chore", "hidden": true },
|
||||
{ "type": "test", "hidden": true },
|
||||
{ "type": "ci", "hidden": true },
|
||||
{ "type": "build", "hidden": true },
|
||||
{ "type": "style", "hidden": true }
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/changelog",
|
||||
{
|
||||
"changelogFile": "CHANGELOG.md",
|
||||
"changelogTitle": "# Ordinis Release Notes\n\nAuto-generated by semantic-release based on conventional commits.\nSee `.releaserc.json` for release rules."
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/npm",
|
||||
{
|
||||
"npmPublish": false,
|
||||
"tarballDir": false
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/git",
|
||||
{
|
||||
"assets": ["package.json", "CHANGELOG.md"],
|
||||
"message": "chore(release): v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/gitlab",
|
||||
{
|
||||
"gitlabUrl": "https://git.nstart.cloud"
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user