Skip to main content

CI/CD

Deployments are fully automated via GitHub Actions. Pushing to a branch triggers the corresponding workflow, which connects to the server over SSH and runs the deploy steps remotely.

Branches and environments

BranchEnvironmentServer path (BE)Server path (FE)
stageStaging/opt/github/be-create-labs/stage/be-create-lab-studio/var/www/html/fe-create-labs/stage/fe-create-lab-studio
mainProduction/opt/github/be-create-labs/prod/be-create-lab-studio/var/www/html/fe-create-labs/prod/fe-create-lab-studio

Both environments run on the same server (87.204.212.184, port 2222).

Required secrets

SecretUsed by
SSH_PRIVATE_KEYAll four workflows — authenticates the GitHub Actions runner to the server

Backend workflows

Staging (stagebe-create-lab-studio/.github/workflows/deploy-stage.yml)

1. git fetch + git reset --hard origin/stage + git clean -fd
2. npm ci
3. npm run build
4. npm run db:migrate ← pending migrations applied automatically
5. pm2 restart be-create-lab-studio-stage --update-env

Production (mainbe-create-lab-studio/.github/workflows/deploy.yml)

1. git fetch + git reset --hard origin/main + git clean -fd
2. npm ci
3. npm run build
4. pm2 restart be-create-lab-studio-prod --update-env

Frontend workflows

Both FE workflows are identical in structure — they differ only in branch and server path.

Staging (stagefe-create-lab-studio/.github/workflows/deploy-stage.yml)

1. git pull
2. npm install
3. npm run build
4. sudo systemctl reload nginx

Production (mainfe-create-lab-studio/.github/workflows/deploy.yml)

1. git pull
2. npm install
3. npm run build
4. sudo systemctl reload nginx