Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Release

on:
push:
branches:
- main
- master

permissions:
contents: read

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: latest

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Install backend dependencies
run: |
cd backend
pnpm install --frozen-lockfile

- name: Install frontend dependencies
run: |
cd frontend
pnpm install --frozen-lockfile

- name: Build backend
run: |
cd backend
pnpm build

- name: Build frontend
run: |
cd frontend
pnpm build

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm semantic-release
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
140 changes: 140 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
{
"branches": [
"main",
"master"
],
"repositoryUrl": "https://github.com/your-username/tech-test",
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"type": "feat",
"release": "minor"
},
{
"type": "fix",
"release": "patch"
},
{
"type": "docs",
"release": "patch"
},
{
"type": "style",
"release": "patch"
},
{
"type": "refactor",
"release": "patch"
},
{
"type": "perf",
"release": "patch"
},
{
"type": "test",
"release": "patch"
},
{
"type": "build",
"release": "patch"
},
{
"type": "ci",
"release": "patch"
},
{
"type": "chore",
"release": "patch"
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "✨ Features"
},
{
"type": "fix",
"section": "🐛 Bug Fixes"
},
{
"type": "docs",
"section": "📚 Documentation"
},
{
"type": "style",
"section": "💎 Styles"
},
{
"type": "refactor",
"section": "📦 Code Refactoring"
},
{
"type": "perf",
"section": "🚀 Performance Improvements"
},
{
"type": "test",
"section": "🚨 Tests"
},
{
"type": "build",
"section": "🛠 Builds"
},
{
"type": "ci",
"section": "⚙️ Continuous Integrations"
},
{
"type": "chore",
"section": "♻️ Chores"
}
]
}
}
],
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/github",
{
"assets": [
{
"path": "backend/dist/**/*",
"label": "Backend Build"
},
{
"path": "frontend/dist/**/*",
"label": "Frontend Build"
}
]
}
],
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md",
"package.json",
"backend/package.json",
"frontend/package.json"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}
112 changes: 112 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Tech Test Project

Повнофункціональний проект з бекендом (Express.js + TypeScript + PostgreSQL) та CI/CD через semantic-release.

## Структура проекту

```
tech-test/
├── backend/ # Express.js API сервер
├── frontend/ # Фронтенд додаток
├── .github/ # GitHub Actions workflows
└── package.json # Root скрипти та semantic-release
```

## Встановлення та запуск

### Root команди
```bash
# Встановити всі залежності
pnpm install

# Розробка
pnpm dev # Backend development server
pnpm dev:frontend # Frontend development server

# Збірка
pnpm build # Build backend + frontend
pnpm build:backend # Тільки backend
pnpm build:frontend # Тільки frontend

# Production
pnpm start # Start backend server
```

### Backend окремо
```bash
cd backend
pnpm dev # Development with hot reload
pnpm build # Production build
pnpm start # Start production server
```

## CI/CD & Releases

### Semantic Release
Проект використовує [semantic-release](https://semantic-release.gitbook.io/) для автоматичних релізів:

#### Commit Message Convention
```bash
feat: add new feature # minor version bump
fix: bug fix # patch version bump
docs: update documentation # patch version bump
style: formatting changes # patch version bump
refactor: code refactoring # patch version bump
perf: performance improvement # patch version bump
test: add tests # patch version bump
build: build system changes # patch version bump
ci: CI configuration changes # patch version bump
chore: maintenance tasks # patch version bump
```

#### Приклади commit messages:
```bash
feat: add user authentication API
fix: resolve database connection timeout
docs: update API documentation
refactor: improve error handling in auth middleware
```

### GitHub Actions

#### Release Workflow
- **Trigger**: Push до `main`/`master` branch
- **Дії**:
1. Build backend та frontend
2. Створити GitHub release з changelog
3. Завантажити build артефакти
4. Оновити CHANGELOG.md

### Налаштування Repository

1. **GitHub Settings > Actions > General**:
- Workflow permissions: "Read and write permissions"
- Allow GitHub Actions to create and approve pull requests: ✅

2. **Repository settings**:
- Встановити default branch як `main`
- Налаштувати branch protection rules (опціонально)

### Manual Release
```bash
# Локальний релім (тільки для тестування)
pnpm semantic-release --dry-run

# Force релім (якщо потрібно)
pnpm semantic-release --no-ci
```

## Environment Variables

### Backend
Див. `backend/.env.example` для списку необхідних змінних.

### Frontend
Див. `frontend/.env.example` для конфігурації фронтенда.

## Версії та Changelog

- Версії автоматично генеруються через semantic-release
- CHANGELOG.md автоматично оновлюється
- GitHub releases створюються автоматично
- Build артефакти завантажуються до GitHub releases
22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "tech-test",
"version": "1.0.0",
"description": "Tech test project with Express.js backend",
"private": true,
"scripts": {
"dev": "cd backend && pnpm dev",
"dev:frontend": "cd frontend && pnpm dev",
"build": "pnpm build:backend && pnpm build:frontend",
"build:backend": "cd backend && pnpm build",
"build:frontend": "cd frontend && pnpm build",
"start": "cd backend && pnpm start",
"semantic-release": "semantic-release"
},
"devDependencies": {
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^11.0.6",
"conventional-changelog-conventionalcommits": "^9.1.0",
"semantic-release": "^24.2.8"
}
}
Loading