stuff
This commit is contained in:
parent
7726920e91
commit
5eed9dc2f1
3 changed files with 163 additions and 0 deletions
42
tools/deploy/README-bump-version.md
Normal file
42
tools/deploy/README-bump-version.md
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
# Version Bump Script
|
||||||
|
|
||||||
|
## bump-version.sh
|
||||||
|
|
||||||
|
Автоматический скрипт для увеличения версии приложения перед deploy.
|
||||||
|
|
||||||
|
### Что делает скрипт:
|
||||||
|
|
||||||
|
1. **Читает текущую версию** из `mnemo_cards_web_v2/pubspec.yaml`
|
||||||
|
2. **Увеличивает patch версию** (третье число в `major.minor.patch+build`)
|
||||||
|
3. **Обновляет pubspec.yaml** с новой версией
|
||||||
|
4. **Обновляет API config** (`api_config_v2.dart`) с версией без build номера
|
||||||
|
5. **Коммитит изменения** в git с сообщением "🔄 Bump version to X.Y.Z+N"
|
||||||
|
|
||||||
|
### Формат версии:
|
||||||
|
|
||||||
|
- **pubspec.yaml**: `major.minor.patch+build` (например: `1.0.1+2`)
|
||||||
|
- **API config**: `major.minor.patch` (например: `'1.0.1'`)
|
||||||
|
|
||||||
|
### Использование:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Из корневой директории проекта
|
||||||
|
./tools/deploy/bump-version.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Пример работы:
|
||||||
|
|
||||||
|
```
|
||||||
|
🔄 Starting version bump process...
|
||||||
|
📊 Current version: 1.0.0+1
|
||||||
|
⬆️ New version: 1.0.1+2
|
||||||
|
✅ Updated mnemo_cards_web_v2/pubspec.yaml
|
||||||
|
✅ Updated mnemo_cards_web_v2/lib/domain/config/api_config_v2.dart
|
||||||
|
📝 Committing version bump...
|
||||||
|
✅ Version bump committed
|
||||||
|
🎉 Version successfully bumped to 1.0.1+2
|
||||||
|
```
|
||||||
|
|
||||||
|
### Интеграция в CI/CD:
|
||||||
|
|
||||||
|
Скрипт автоматически запускается как pre-hook в GitHub Actions workflow перед каждым deploy'ем веб-приложения.
|
||||||
60
tools/deploy/bump-version.sh
Executable file
60
tools/deploy/bump-version.sh
Executable file
|
|
@ -0,0 +1,60 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "🔄 Starting version bump process..."
|
||||||
|
|
||||||
|
# Check if we're in the project root
|
||||||
|
if [ ! -f "mnemo_cards_web_v2/pubspec.yaml" ]; then
|
||||||
|
echo "❌ Error: This script must be run from the project root directory"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get current version from pubspec.yaml
|
||||||
|
CURRENT_VERSION=$(grep "^version:" mnemo_cards_web_v2/pubspec.yaml | cut -d' ' -f2 | tr -d "'\"")
|
||||||
|
echo "📊 Current version: $CURRENT_VERSION"
|
||||||
|
|
||||||
|
# Parse version components (format: major.minor.patch+build)
|
||||||
|
if [[ $CURRENT_VERSION =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)(\+([0-9]+))?$ ]]; then
|
||||||
|
MAJOR=${BASH_REMATCH[1]}
|
||||||
|
MINOR=${BASH_REMATCH[2]}
|
||||||
|
PATCH=${BASH_REMATCH[3]}
|
||||||
|
BUILD=${BASH_REMATCH[5]:-0}
|
||||||
|
|
||||||
|
# Increment patch version
|
||||||
|
NEW_PATCH=$((PATCH + 1))
|
||||||
|
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH+$((BUILD + 1))"
|
||||||
|
else
|
||||||
|
echo "❌ Error: Invalid version format: $CURRENT_VERSION"
|
||||||
|
echo "Expected format: major.minor.patch+build"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "⬆️ New version: $NEW_VERSION"
|
||||||
|
|
||||||
|
# Update API config (remove +build part for display version)
|
||||||
|
DISPLAY_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
|
||||||
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
# macOS
|
||||||
|
sed -i '' "s/^version: .*/version: $NEW_VERSION/" mnemo_cards_web_v2/pubspec.yaml
|
||||||
|
sed -i '' "s/static const String appVersion = '.*';/static const String appVersion = '$DISPLAY_VERSION';/" mnemo_cards_web_v2/lib/domain/config/api_config_v2.dart
|
||||||
|
else
|
||||||
|
# Linux
|
||||||
|
sed -i "s/^version: .*/version: $NEW_VERSION/" mnemo_cards_web_v2/pubspec.yaml
|
||||||
|
sed -i "s/static const String appVersion = '.*';/static const String appVersion = '$DISPLAY_VERSION';/" mnemo_cards_web_v2/lib/domain/config/api_config_v2.dart
|
||||||
|
fi
|
||||||
|
echo "✅ Updated mnemo_cards_web_v2/pubspec.yaml"
|
||||||
|
echo "✅ Updated mnemo_cards_web_v2/lib/domain/config/api_config_v2.dart"
|
||||||
|
|
||||||
|
# Commit the changes
|
||||||
|
if [ -n "$(git status --porcelain)" ]; then
|
||||||
|
echo "📝 Committing version bump..."
|
||||||
|
git add mnemo_cards_web_v2/pubspec.yaml
|
||||||
|
git add mnemo_cards_web_v2/lib/domain/config/api_config_v2.dart
|
||||||
|
git commit -m "🔄 Bump version to $NEW_VERSION"
|
||||||
|
echo "✅ Version bump committed"
|
||||||
|
else
|
||||||
|
echo "⚠️ No changes to commit"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "🎉 Version successfully bumped to $NEW_VERSION"
|
||||||
61
tools/deploy/generated_configs/api.mnemo-cards.online.conf
Normal file
61
tools/deploy/generated_configs/api.mnemo-cards.online.conf
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
# Nginx configuration for api.mnemo-cards.online
|
||||||
|
# Generated by generate-nginx-configs.sh on Thu Nov 27 22:14:27 MSK 2025
|
||||||
|
# Service: api
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name api.mnemo-cards.online;
|
||||||
|
return 301 https://$server_name$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl http2;
|
||||||
|
server_name api.mnemo-cards.online;
|
||||||
|
|
||||||
|
# SSL configuration
|
||||||
|
ssl_certificate /etc/letsencrypt/live/mnemo-cards.online/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/mnemo-cards.online/privkey.pem;
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||||
|
|
||||||
|
# Security headers
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||||
|
add_header X-XSS-Protection "1; mode=block" always;
|
||||||
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
|
add_header Referrer-Policy "no-referrer-when-downgrade" always;
|
||||||
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||||
|
|
||||||
|
# API Backend specific settings
|
||||||
|
client_max_body_size 100M;
|
||||||
|
|
||||||
|
# CORS headers for API
|
||||||
|
add_header Access-Control-Allow-Origin "*" always;
|
||||||
|
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS" always;
|
||||||
|
add_header Access-Control-Allow-Headers "Origin, Content-Type, Accept, Authorization, user_token, request_token, app_version" always;
|
||||||
|
add_header Access-Control-Expose-Headers "Authorization" always;
|
||||||
|
add_header Access-Control-Max-Age "86400" always;
|
||||||
|
|
||||||
|
# Handle preflight OPTIONS requests
|
||||||
|
if ($request_method = OPTIONS) {
|
||||||
|
return 204;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Proxy to backend server (HTTPS for API, HTTP for others)
|
||||||
|
location / {
|
||||||
|
proxy_pass https://127.0.0.1:8081;
|
||||||
|
proxy_ssl_verify off; # Skip SSL verification for local connection
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
|
||||||
|
proxy_connect_timeout 60s;
|
||||||
|
proxy_send_timeout 60s;
|
||||||
|
proxy_read_timeout 60s;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Security - deny access to hidden files
|
||||||
|
location ~ /\. {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue