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
| Branch | Environment | Server path (BE) | Server path (FE) |
|---|---|---|---|
stage | Staging | /opt/github/be-create-labs/stage/be-create-lab-studio | /var/www/html/fe-create-labs/stage/fe-create-lab-studio |
main | Production | /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
| Secret | Used by |
|---|---|
SSH_PRIVATE_KEY | All four workflows — authenticates the GitHub Actions runner to the server |
Backend workflows
Staging (stage → be-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 (main → be-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 (stage → fe-create-lab-studio/.github/workflows/deploy-stage.yml)
1. git pull
2. npm install
3. npm run build
4. sudo systemctl reload nginx
Production (main → fe-create-lab-studio/.github/workflows/deploy.yml)
1. git pull
2. npm install
3. npm run build
4. sudo systemctl reload nginx