Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
27e57ef
test: trigger CI pipeline
symonbaikov Sep 14, 2025
f86838f
fix: test CI/CD pipeline fixes
symonbaikov Sep 14, 2025
c14d31c
test: trigger CI pipeline
symonbaikov Sep 14, 2025
52fd746
fix: correct Docker metadata action configuration
symonbaikov Sep 14, 2025
fe67c69
fix: use personal GitHub package instead of organization package
symonbaikov Sep 14, 2025
7a0be60
fix: correct Docker tag format to prevent invalid reference errors
symonbaikov Sep 14, 2025
3ff8999
fix: use hardcoded personal GitHub username for Docker images
symonbaikov Sep 14, 2025
5a38f39
test: temporarily disable Docker push to test build process
symonbaikov Sep 14, 2025
eb1135a
test: attempt automatic package creation via GitHub Actions
symonbaikov Sep 14, 2025
4377e98
fix: switch back to organization package for Docker images
symonbaikov Sep 14, 2025
4f86381
fix: add GitHub Container Registry labels and re-enable push
symonbaikov Sep 14, 2025
2d3cc2a
fix: add required permissions for Docker package creation
symonbaikov Sep 14, 2025
601e6a1
fix: move LABEL instructions to production stage in Dockerfile
symonbaikov Sep 14, 2025
cc0b1c4
test: trigger CI pipeline
symonbaikov Sep 14, 2025
c12ab7a
Disable deploy-staging and cleanup-pr jobs (no staging server configu…
symonbaikov Sep 14, 2025
dcd4018
Add required permissions to docker-optimized and deploy-production wo…
symonbaikov Sep 14, 2025
a2ef515
Disable GitHub Actions cache export due to service outage
symonbaikov Sep 14, 2025
5012f29
Add full SHA tag for Trivy security scanner compatibility
symonbaikov Sep 14, 2025
ffef391
test: trigger CI pipeline
symonbaikov Sep 14, 2025
f30ba25
Add manual frontend deployment workflow for AWS S3
symonbaikov Sep 14, 2025
6a30bfb
test: trigger CI pipeline
symonbaikov Sep 14, 2025
54f100a
test: trigger CI pipeline
symonbaikov Sep 14, 2025
11585b3
Fix Slack error and add email notifications to peterbaikov12@gmail.com
symonbaikov Sep 14, 2025
3e9329d
test: trigger CI pipeline
symonbaikov Sep 14, 2025
3ceda22
Update deploy-frontend-aws.yml
symonbaikov Sep 14, 2025
d78b0de
Fix monitoring workflow: remove Slack notifications causing SLACK_WEB…
symonbaikov Sep 15, 2025
f5c3f40
Fix monitoring workflow formatting and remove remaining Slack references
symonbaikov Sep 15, 2025
60e84cf
Fix performance test: allow running on all branches when build succeeds
symonbaikov Sep 15, 2025
d34bf36
Force workflow update: ensure latest version is used
symonbaikov Sep 15, 2025
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
248 changes: 248 additions & 0 deletions .github/workflows/database-migration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
name: Database Migration

on:
push:
branches: [master, develop]
paths:
- "prisma/migrations/**"
- "prisma/schema.prisma"
workflow_dispatch:
inputs:
environment:
description: "Environment to migrate"
required: true
default: "staging"
type: choice
options:
- staging
- production
migration_type:
description: "Migration type"
required: true
default: "deploy"
type: choice
options:
- deploy
- reset
- status

jobs:
# Validate migration files
validate-migrations:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Validate Prisma schema
run: npx prisma validate

- name: Check for migration conflicts
run: |
# Check if there are any pending migrations
npx prisma migrate status --schema=./prisma/schema.prisma

- name: Generate Prisma client
run: npx prisma generate

# Backup database before migration
backup-database:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
runs-on: ubuntu-latest
needs: validate-migrations
if: github.event.inputs.environment == 'production' || github.ref == 'refs/heads/master'
environment: ${{ github.event.inputs.environment || 'production' }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Create database backup
run: |
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
BACKUP_FILE="worknow_backup_${TIMESTAMP}.sql"

# Create backup using pg_dump
PGPASSWORD="${{ secrets.DATABASE_PASSWORD }}" pg_dump \
-h "${{ secrets.DATABASE_HOST }}" \
-U "${{ secrets.DATABASE_USER }}" \
-d "${{ secrets.DATABASE_NAME }}" \
-f "$BACKUP_FILE"

# Upload backup to S3 or similar storage
aws s3 cp "$BACKUP_FILE" "s3://${{ secrets.BACKUP_BUCKET }}/database-backups/$BACKUP_FILE"

echo "BACKUP_FILE=$BACKUP_FILE" >> $GITHUB_ENV

- name: Send backup completion email
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 587
username: ${{ secrets.EMAIL_USERNAME }}
password: ${{ secrets.EMAIL_PASSWORD }}
subject: "WorkNow Database Backup Completed"
to: peterbaikov12@gmail.com
from: ${{ secrets.EMAIL_USERNAME }}
body: |
✅ WorkNow Database Backup Completed!

Backup File: ${{ env.BACKUP_FILE }}
Environment: ${{ github.event.inputs.environment || 'production' }}
Branch: ${{ github.ref_name }}
Commit: ${{ github.sha }}
Backed up at: $(date)

The database backup has been successfully created and uploaded to S3.

Best regards,
WorkNow CI/CD System

# Run migrations on staging
migrate-staging:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
runs-on: ubuntu-latest
needs: validate-migrations
if: github.event.inputs.environment == 'staging' || github.ref == 'refs/heads/develop'
environment: staging

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run staging migrations
run: |
if [ "${{ github.event.inputs.migration_type }}" = "reset" ]; then
npx prisma migrate reset --force
elif [ "${{ github.event.inputs.migration_type }}" = "status" ]; then
npx prisma migrate status
else
npx prisma migrate deploy
fi
env:
DATABASE_URL: ${{ secrets.STAGING_DATABASE_URL }}

- name: Verify staging migration
run: |
npx prisma db push --accept-data-loss
npx prisma generate
env:
DATABASE_URL: ${{ secrets.STAGING_DATABASE_URL }}

# Run migrations on production
migrate-production:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
runs-on: ubuntu-latest
needs: [validate-migrations, backup-database]
if: github.event.inputs.environment == 'production' || github.ref == 'refs/heads/master'
environment: production

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run production migrations
run: |
# Always use deploy for production (never reset)
npx prisma migrate deploy
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}

- name: Verify production migration
run: |
npx prisma db push --accept-data-loss
npx prisma generate
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}

- name: Run data integrity checks
run: |
# Add custom data integrity checks here
node -e "
const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient();

// Check critical tables have data
Promise.all([
prisma.user.count(),
prisma.job.count(),
prisma.category.count(),
prisma.city.count()
]).then(([users, jobs, categories, cities]) => {
console.log('Data integrity check:');
console.log('Users:', users);
console.log('Jobs:', jobs);
console.log('Categories:', categories);
console.log('Cities:', cities);

if (users === 0 || categories === 0 || cities === 0) {
console.error('Critical data missing!');
process.exit(1);
}

console.log('Data integrity check passed ✅');
prisma.$disconnect();
}).catch(err => {
console.error('Data integrity check failed:', err);
process.exit(1);
});
"
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}

# Notify migration completion
notify-completion:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
runs-on: ubuntu-latest
needs: [migrate-staging, migrate-production]
if: always()

steps:
- name: Send migration completion email
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 587
username: ${{ secrets.EMAIL_USERNAME }}
password: ${{ secrets.EMAIL_PASSWORD }}
subject: "WorkNow Database Migration Completed"
to: peterbaikov12@gmail.com
from: ${{ secrets.EMAIL_USERNAME }}
body: |
✅ WorkNow Database Migration Completed!

Environment: ${{ github.event.inputs.environment || 'auto-detected' }}
Migration Type: ${{ github.event.inputs.migration_type || 'deploy' }}
Branch: ${{ github.ref_name }}
Commit: ${{ github.sha }}
Completed at: $(date)

The database migration has been completed successfully.
Data integrity checks passed.

Best regards,
WorkNow CI/CD System

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
133 changes: 133 additions & 0 deletions .github/workflows/deploy-frontend-aws.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: Deploy Frontend to AWS S3 (Manual Only) - Updated

on:
workflow_dispatch:
inputs:
environment:
description: "Environment to deploy to"
required: true
default: "production"
type: choice
options:
- production
- staging
confirm_deployment:
description: "Type 'DEPLOY' to confirm deployment"
required: true
type: string

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

- name: Build application
run: npm run build

deploy-frontend:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
runs-on: ubuntu-latest
needs: build-and-test
environment: ${{ github.event.inputs.environment }}
if: github.event.inputs.confirm_deployment == 'DEPLOY'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Build frontend for production
run: |
VITE_API_URL=https://api.worknow.co.il \
VITE_CLERK_PUBLISHABLE_KEY=${{ secrets.VITE_CLERK_PUBLISHABLE_KEY }} \
CLERK_SECRET_KEY=${{ secrets.CLERK_SECRET_KEY }} \
npm run build

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Navigate to client directory
run: cd apps/client

- name: Deploy to AWS S3
run: |
cd apps/client
aws s3 sync dist/ s3://worknow-frontend --delete

- name: Send email notification
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 587
username: ${{ secrets.EMAIL_USERNAME }}
password: ${{ secrets.EMAIL_PASSWORD }}
subject: "WorkNow Frontend Deployment Success"
to: peterbaikov12@gmail.com
from: ${{ secrets.EMAIL_USERNAME }}
body: |
🚀 WorkNow Frontend Deployment Successful!

Environment: ${{ github.event.inputs.environment }}
Commit: ${{ github.sha }}
Branch: ${{ github.ref }}
Deployed at: $(date)

The frontend has been successfully deployed to AWS S3.

Best regards,
WorkNow CI/CD System

rollback:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
runs-on: ubuntu-latest
needs: deploy-frontend
if: failure()
environment: ${{ github.event.inputs.environment }}
steps:
- name: Send failure email notification
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 587
username: ${{ secrets.EMAIL_USERNAME }}
password: ${{ secrets.EMAIL_PASSWORD }}
subject: "WorkNow Frontend Deployment Failed"
to: peterbaikov12@gmail.com
from: ${{ secrets.EMAIL_USERNAME }}
body: |
❌ WorkNow Frontend Deployment Failed!

Environment: ${{ github.event.inputs.environment }}
Commit: ${{ github.sha }}
Branch: ${{ github.ref }}
Failed at: $(date)

The frontend deployment has failed. Manual intervention required.

Please check the GitHub Actions logs for more details.

Best regards,
WorkNow CI/CD System

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
Loading
Loading