Skip to content
This repository was archived by the owner on Dec 7, 2025. It is now read-only.

Commit 9fc623f

Browse files
Merge pull request #16 from justgithubaccount/feat/ci-improvements-full
feat: add semantic release workflow with helm chart packaging
2 parents 245bcf4 + afa49fe commit 9fc623f

File tree

3 files changed

+82
-34
lines changed

3 files changed

+82
-34
lines changed

.github/workflows/.releaserc.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"branches": [
3+
{
4+
"name": "main",
5+
"prerelease": "alpha"
6+
}
7+
],
8+
"plugins": [
9+
"@semantic-release/commit-analyzer",
10+
"@semantic-release/release-notes-generator",
11+
[
12+
"@semantic-release/github",
13+
{
14+
"assets": [
15+
"chat-*.tgz"
16+
]
17+
}
18+
]
19+
]
20+
}

.github/workflows/build-and-push.yaml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'apps/chat/**'
8+
- '.github/workflows/release.yaml'
9+
10+
jobs:
11+
build-and-release:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
packages: write
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
# 1. Semantic Release (создает версию)
22+
- name: Semantic Release
23+
id: semantic
24+
uses: cycjimmy/semantic-release-action@v4
25+
with:
26+
semantic_version: 21
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
30+
# 1.5. Обновить Chart.yaml и упаковать Helm
31+
- name: Install Helm
32+
if: steps.semantic.outputs.new_release_published == 'true'
33+
uses: azure/setup-helm@v3
34+
35+
- name: Update Chart Version
36+
if: steps.semantic.outputs.new_release_published == 'true'
37+
run: |
38+
VERSION=${{ steps.semantic.outputs.new_release_version }}
39+
sed -i "s/^version:.*/version: $VERSION/" charts/chat/Chart.yaml
40+
sed -i "s/^appVersion:.*/appVersion: \"$VERSION\"/" charts/chat/Chart.yaml
41+
42+
- name: Package Helm Chart
43+
if: steps.semantic.outputs.new_release_published == 'true'
44+
run: helm package charts/chat --destination ./
45+
46+
# 2. Docker build с версией
47+
- name: Log in to GitHub Container Registry
48+
uses: docker/login-action@v2
49+
with:
50+
registry: ghcr.io
51+
username: ${{ github.actor }}
52+
password: ${{ secrets.GITHUB_TOKEN }}
53+
54+
- name: Build and push Docker image
55+
uses: docker/build-push-action@v5
56+
with:
57+
context: ./apps/chat
58+
push: true
59+
tags: |
60+
ghcr.io/justgithubaccount/chat-api:latest
61+
ghcr.io/justgithubaccount/chat-api:${{ github.sha }}
62+
${{ steps.semantic.outputs.new_release_version && format('ghcr.io/justgithubaccount/chat-api:{0}', steps.semantic.outputs.new_release_version) || '' }}

0 commit comments

Comments
 (0)