CI/CD for Web Developers: Automating Your Git Deployments
Deploying a website or web application should not require repeating the same manual steps every time you update your code.
Yet many developers still download files, upload them through FTP, edit production files manually, run commands directly on a live server and hope nothing breaks. This process can work for small projects, but it becomes harder to manage as applications grow, teams expand and updates become more frequent.
A missed file, an incorrect configuration, an unfinished database migration or a deployment to the wrong server can cause errors, downtime and unnecessary troubleshooting.
Continuous integration and continuous delivery or deployment (CI/CD) help developers automate the journey from code changes to a tested, deployable application.
By connecting Git repositories to automated workflows, developers can run tests, check code quality, build applications and deploy approved changes with fewer repetitive manual steps.
This guide explains how CI/CD works, how to automate Git deployments, what tools you need and how to build a reliable deployment pipeline for your website or application.
What Is CI/CD?
CI/CD is a set of development practices and automated workflows designed to make software changes easier to test, deliver and deploy.
The two main concepts are continuous integration and continuous delivery or deployment.
Continuous Integration (CI)
Continuous integration involves regularly integrating code changes into a shared repository and automatically checking those changes.
When a developer pushes code or opens a pull request, a CI workflow can:
Install the project's dependencies.
Run automated tests.
Check code style and quality.
Identify certain security or dependency issues.
Build the application to confirm that it can be packaged successfully.
The objective is to identify problems early, before they reach production.
For example, if a developer changes a login function and accidentally breaks an existing test, the CI workflow can flag the failure before the change is merged into the main branch.
Continuous Delivery
Continuous delivery extends CI by ensuring that the application can be prepared for release consistently.
The pipeline may test the application, create a production build and publish a deployment artifact. A developer or authorised team member can then approve the release.
This approach gives teams a repeatable release process while retaining a manual approval step before production deployment.
Continuous Deployment
Continuous deployment takes automation further. When a change passes the required checks and meets the deployment rules, it is released to production automatically.
This can shorten release cycles, but it requires confidence in automated testing, monitoring, security and recovery procedures.
A failed test should prevent an unsafe release from progressing. A successful test suite, however, does not guarantee that an application is free from every defect.
How a Git-Based CI/CD Pipeline Works
Git provides version control, allowing developers to track changes, collaborate and return to earlier versions of their code. A CI/CD platform connects the repository to automated checks and deployment steps.
A typical workflow looks like this:
<box border radius="xl" padding={3} gap={2}>
<box background="surface-secondary" radius="lg" padding={3} align="center" gap={1}>
<icon name="git-branch" size="xl" />
**1. Developer changes code**
<text color="secondary" size="sm" textAlign="center">Work locally in a feature branch or on an approved branch.</text>
</box>
<row justify="center">
<icon name="arrow-down" size="lg" color="secondary" />
</row>
<box background="surface" border radius="lg" padding={3} align="center" gap={1}>
<icon name="git-pull-request" size="xl" />
**2. Push to the Git repository**
<text color="secondary" size="sm" textAlign="center">The repository receives the commit or pull request.</text>
</box>
<row justify="center">
<icon name="arrow-down" size="lg" color="secondary" />
</row>
<box background="surface" border radius="lg" padding={3} align="center" gap={1}>
<icon name="check-circle" size="xl" />
**3. Run automated checks**
<text color="secondary" size="sm" textAlign="center">Install dependencies, run tests, lint and build the application.</text>
</box>
<row justify="center">
<icon name="arrow-down" size="lg" color="secondary" />
</row>
<box background="surface" border radius="lg" padding={3} align="center" gap={1}>
<icon name="shield-check" size="xl" />
**4. Approve the release**
<text color="secondary" size="sm" textAlign="center">Merge approved changes and apply production deployment rules.</text>
</box>
<row justify="center">
<icon name="arrow-down" size="lg" color="secondary" />
</row>
<box background="surface" border radius="lg" padding={3} align="center" gap={1}>
<icon name="rocket" size="xl" />
**5. Deploy the application**
<text color="secondary" size="sm" textAlign="center">Publish the tested build or deploy the approved commit to the target server.</text>
</box>
<row justify="center">
<icon name="arrow-down" size="lg" color="secondary" />
</row>
<box background="surface-secondary" radius="lg" padding={3} align="center" gap={1}>
<icon name="activity" size="xl" />
**6. Verify and monitor**
<text color="secondary" size="sm" textAlign="center">Check application health, logs and important user-facing functions.</text>
</box>
</box>
The exact stages vary by project. A static website may need only a build and file publication step, while a database-backed application may also require migrations, cache management, queue workers and service restarts.
Why Web Developers Should Automate Git Deployments
Automation is not just about saving a few minutes. It makes the release process more consistent and easier to audit.
1. Reduce Repetitive Manual Work
A manual deployment may involve connecting to a server, copying files, installing dependencies, rebuilding assets and restarting services.
A pipeline can automate many of these steps using a defined workflow. Developers can then spend less time repeating commands and more time improving the application.
2. Catch Errors Before Production
Automated tests and build checks can identify common problems before a release reaches users.
For example, a failed build can prevent a deployment that would otherwise publish incomplete assets or broken application code.
The earlier a defect is detected, the easier it is often to identify which change introduced it.
3. Make Releases More Consistent
Manual deployments often depend on individual knowledge. One developer may remember to clear a cache, while another forgets to run a required command.
A pipeline documents the process in code and executes the configured steps consistently.
Consistency does not automatically make a workflow correct, so the pipeline itself must be reviewed and tested.
4. Improve Collaboration Between Developers
In a team, different developers may contribute code to the same application. A shared CI/CD workflow helps establish a common release standard.
Pull requests can trigger tests before changes are merged, and protected branches can require successful checks before accepting code.
This helps teams identify integration problems earlier and reduces reliance on informal approval processes.
5. Support More Frequent Releases
When testing and deployment steps are repeatable, developers can release smaller changes more frequently instead of combining many updates into one risky deployment.
Smaller releases are often easier to troubleshoot because fewer changes are involved.
However, deployment frequency should match the application's testing maturity, operational requirements and risk profile.
Tools You Can Use to Automate Git Deployments
You do not need a large DevOps platform to get started. The right tools depend on your repository, framework, hosting environment and deployment method.
Tool or service | Main purpose | Common use case |
|---|---|---|
Git | Tracks changes to application code | Version control and collaboration |
GitHub Actions | Runs automated workflows connected to GitHub repositories | Testing, building and deploying applications |
GitLab CI/CD | Runs pipelines defined in GitLab repositories | Integrated testing and deployment |
Jenkins | Provides a configurable automation server | Custom CI/CD workflows and self-hosted environments |
Docker | Packages applications and their dependencies into containers | Consistent builds and container-based deployment |
SSH | Provides secure remote access to servers | Running approved deployment commands |
Container registry | Stores versioned container images | Publishing and deploying application images |
These tools serve different roles. Git is version control, CI/CD platforms orchestrate workflows, SSH provides remote access and Docker packages applications. They can be combined in different ways.
For example, a developer might use GitHub Actions to test a Laravel application, build its production assets and deploy the approved version to a VPS over SSH.
Step-by-Step: Build Your First Git Deployment Workflow
The following steps describe a practical starting point. The precise configuration will depend on your framework and hosting environment.
Step 1: Put Your Application Under Version Control
If your project is not already using Git, initialise a repository and commit the files that belong in source control.
A typical starting sequence is:
git init
git add .
git commit -m "Initial application version"Create a remote repository and push the code to your chosen Git hosting platform.
Before committing, add a suitable .gitignore file. Do not commit secrets, private keys, production environment files or generated directories that should not be tracked.
For a PHP application, for example, .env files commonly contain database credentials and application secrets. These should be managed securely outside the repository.
Step 2: Establish a Branching and Review Strategy
Choose a workflow that matches your team size.
A small team may use feature branches and pull requests, with the main branch representing approved code. Larger teams may use additional release branches or other strategies.
For example:
feature/login-improvementscontains a specific change.A pull request runs tests and allows review.
Approved code is merged into
main.A production workflow deploys the approved version.
Protect important branches with appropriate permissions and required checks where your Git platform supports them.
The goal is to prevent unreviewed or failing changes from reaching production through the normal workflow.
Step 3: Define the Automated Checks
Start with checks that provide clear value and are practical to maintain.
Depending on the application, these may include:
Dependency installation.
Unit and integration tests.
Code formatting or linting.
Type checking.
Front-end asset compilation.
Dependency vulnerability checks.
Application packaging or container builds.
Not every project needs every check from day one. Start with the most important tests and expand the pipeline as the application matures.
A pipeline should fail clearly when a required check fails, rather than silently continuing to deployment.
Step 4: Configure the Build Environment
A build should run in an environment that matches the application's requirements.
Specify the supported runtime version, dependency installation method and build commands. Use lockfiles, such as package-lock.json or composer.lock, to make dependency resolution more reproducible.
For front-end projects, a build may compile TypeScript, bundle JavaScript, optimise CSS or generate static pages.
For a PHP application, the pipeline may install Composer dependencies and run tests. A Node.js service may need dependency installation, tests and a production build.
The pipeline should produce a clearly identifiable output, such as a versioned build artifact, static directory or container image.
Step 5: Store Deployment Credentials Securely
Automated deployments may require access to a server, registry or cloud environment.
Do not place passwords, private keys, API tokens or production credentials directly in your workflow files or source code.
Use the CI/CD platform's secret-management features or an appropriate secrets manager. Restrict access to the credentials and grant only the permissions needed for deployment.
Where possible:
Use a dedicated deployment account.
Limit SSH access to the required destination.
Verify the server's SSH host key.
Separate staging and production credentials.
Protect production environments with approval rules.
Rotate credentials when exposure is suspected or access responsibilities change.
A workflow that runs untrusted code should not receive unrestricted access to production secrets.
Step 6: Deploy to a Staging Environment First
A staging environment provides a place to test the release before exposing it to real users.
Ideally, it should resemble production in its runtime, dependencies and configuration, while using appropriate test data and separate credentials.
Use staging to verify:
The application starts successfully.
Required environment variables are present.
Database connectivity works.
Important routes and pages respond correctly.
Authentication and other critical functions operate as expected.
Background jobs and integrations behave correctly where applicable.
Staging cannot reproduce every production condition, but it can catch many configuration and integration problems before release.
Step 7: Automate the Production Deployment
Once the pipeline has passed the required checks and the release is approved, the workflow can deploy the tested version to production.
The deployment method depends on the application and hosting platform.
Common approaches include:
Git-based deployment: The server retrieves an approved revision from the repository and runs the required deployment commands.
Artifact deployment: The pipeline packages the application and transfers the built artifact to the server.
Container deployment: The pipeline builds a container image, publishes it to a registry and updates the running service to use the approved image.
For production systems, prefer deploying a specific commit, artifact or image version instead of an ambiguous moving reference. This makes it easier to identify what is running and to recover a previous release.
Step 8: Run Post-Deployment Checks
A successful deployment command does not necessarily mean the application is healthy.
After deployment, verify that the application responds, key pages or endpoints work, logs do not show critical errors and important background processes are operating.
Where appropriate, use a health-check endpoint or a small set of automated smoke tests.
If a check fails, the pipeline should alert the responsible team and follow the documented recovery procedure.
Step 9: Monitor and Improve the Pipeline
Review deployment logs, failed jobs, release duration and production incidents.
Look for repetitive failures, unreliable tests, slow dependency installation and steps that require unnecessary manual intervention.
Improve the pipeline gradually rather than adding complexity without a clear benefit.
Example: A Basic GitHub Actions Workflow for CI
The following example demonstrates continuous integration for a Node.js application. It installs dependencies, runs tests and builds the project whenever code is pushed or a pull request targets the main branch.
It is a CI example, not a production deployment workflow. It assumes the repository contains a compatible package-lock.json and that npm test and npm run build are defined in package.json.
Create the file .github/workflows/ci.yml:
name: Node.js CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test-and-build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Build application
run: npm run buildThis workflow provides a basic automated check before changes are released. Replace the Node.js version with one supported by your application, and select action versions according to your organisation's security and maintenance policy.
If the project has no test script or build script, configure the appropriate commands for that application rather than copying this example unchanged.
For a production deployment, add a separate workflow or job that runs only after the required checks succeed and the relevant release conditions are satisfied.
Framework-Specific CI/CD Considerations
Different web applications require different deployment steps. A workflow that works for a static website may be incomplete for an application that depends on a database or long-running background processes.
Laravel Applications
A Laravel deployment may require:
Installing production Composer dependencies.
Building front-end assets when applicable.
Configuring environment variables securely.
Running database migrations carefully.
Clearing or rebuilding the appropriate caches.
Ensuring storage permissions are correct.
Restarting long-running queue workers when required.
Verifying application health after deployment.
Database migrations deserve special attention. A migration that removes or renames a column may break the currently running application if the old and new versions overlap during deployment.
For high-availability systems, consider backward-compatible migrations that allow the current and new application versions to coexist during the transition.
See the related guide: Deploying Laravel on a VPS: A Practical Checklist.
Node.js Applications
A Node.js deployment may require:
Installing dependencies from the lockfile.
Running tests and compiling the application.
Supplying production environment variables.
Building or publishing the production artifact.
Updating the running service.
Restarting the process using the appropriate process manager or container platform.
Verifying health checks, logs and background tasks.
Avoid assuming that every Node.js application uses the same process manager or directory layout. The pipeline should match the way the application is actually hosted.
Learn more about Node.js developer hosting.
Docker-Based Applications
Docker can help make builds more consistent by packaging an application with its required runtime components.
A container-based pipeline commonly builds an image, runs appropriate tests, publishes the image to a registry and deploys a specific image version to the target environment.
Keep production secrets outside the image, scan dependencies and base images where appropriate, and maintain a clear process for replacing a faulty release.
Docker does not automatically provide zero-downtime deployment, scaling or rollback. Those capabilities depend on the runtime platform and deployment design.
See Docker developer hosting for related hosting information.
Common CI/CD Mistakes to Avoid
Deploying Every Commit Directly to Production
Automatic production deployment may be suitable for mature projects with reliable tests and monitoring. For other applications, it can introduce unnecessary risk.
Use branch protection, required checks and approval rules appropriate to the project's needs.
Storing Secrets in Git
A committed secret may remain in repository history even after the file is deleted.
Use secret-management features, restrict credential permissions and rotate exposed credentials. Removing the visible line from the latest commit alone may not resolve the exposure.
Running Tests Only After Deployment
Production checks are useful, but they should not replace pre-deployment tests.
Run appropriate automated checks before releasing a change, then perform post-deployment health checks to detect issues that only appear in the target environment.
Deploying Untested Artifacts
If production receives different code from the version that passed testing, the pipeline loses an important reliability benefit.
Where practical, promote the same tested artifact or immutable image through staging and production, using environment-specific configuration separately.
Ignoring Database Migrations
Application code and database schemas must remain compatible during a release.
Plan destructive schema changes carefully, consider backward compatibility and confirm how data will be protected if a migration fails.
Failing to Plan for Rollback
A release may introduce an unexpected bug despite passing tests.
Define how to restore the previous application version, how to handle database changes and who is authorised to initiate recovery. Rolling back application code alone may not reverse a database migration safely.
Using Excessive Deployment Permissions
A deployment workflow should not have unrestricted access to every server or repository resource.
Use dedicated credentials, restrict production access and separate workflows that handle untrusted contributions from those that can access sensitive secrets.
Ignoring Logs and Alerts
A pipeline that reports deployment success but does not verify application health can leave errors unnoticed.
Monitor relevant logs, health checks and critical user journeys after release.
How to Build a Reliable Rollback Strategy
Rollback planning is an essential part of CI/CD because not every production problem can be prevented by testing.
A practical recovery strategy should include:
Versioned releases: Record the commit, artifact or container image deployed to production.
A known previous release: Preserve the last working version and the information needed to redeploy it.
Data protection: Back up important data and assess whether a database change can be reversed safely.
Health checks: Define the conditions that should trigger investigation or rollback.
A clear owner: Identify who can authorise and execute recovery.
Regular testing: Test the recovery process in a safe environment rather than assuming it will work.
For applications with strict availability requirements, techniques such as blue-green or canary deployments may reduce the risk of releasing a faulty version. They require suitable infrastructure and careful traffic management, and they are not necessary for every project.
How Hosting Infrastructure Supports CI/CD
A reliable pipeline depends on more than the Git platform. The target hosting environment must support the application's runtime, deployment method, security requirements and operational needs.
For example, a static website may need only a build environment and a destination for publishing generated files. A Laravel or Node.js application may require runtime support, environment configuration, background processes and controlled access to a database.
Before choosing hosting for automated deployments, assess:
Runtime compatibility: Does the environment support your framework and required versions?
Git access: Can you integrate the repository or CI/CD platform using a supported deployment method?
Deployment permissions: Can the pipeline publish updates without giving it unnecessary administrator access?
Environment configuration: Can production secrets and application settings be managed securely?
Process management: Can the environment run and restart the services your application needs?
Monitoring and recovery: Can you inspect logs, verify health and recover from a failed release?
SteboHost offers hosting resources developers can review when planning their deployment workflow:
Check the specific plan's capabilities and deployment instructions before choosing an architecture. Do not assume that every hosting plan supports the same runtime, SSH access, container features or deployment automation.
Frequently Asked Questions
What is CI/CD in web development?
CI/CD refers to practices and automated workflows that test, prepare and release software changes. Continuous integration focuses on integrating and validating code, while continuous delivery prepares releases for deployment and continuous deployment automatically releases changes that meet the configured requirements.
Does CI/CD require Git?
A Git repository is the common foundation for modern web development pipelines, but CI/CD is not inherently limited to Git. In practice, tools such as GitHub Actions and GitLab CI/CD commonly use Git events to trigger workflows.
Can I automate deployments without Docker?
Yes. Docker is optional. You can deploy static files, PHP applications, Node.js services and other web applications using supported methods such as artifact publishing, SSH-based deployment or platform-specific deployment tools.
Is Git deployment the same as CI/CD?
No. Git deployment typically means using a Git repository or Git-based workflow to publish application changes. CI/CD adds automated checks and release processes, although a simple Git deployment can form part of a larger pipeline.
Can CI/CD deploy directly to a VPS?
Yes, provided the VPS and deployment workflow are configured appropriately. Common approaches include transferring a tested artifact over SSH or deploying a versioned container image. Secure credentials, limited permissions, environment configuration and a recovery plan are important.
Is CI/CD suitable for small development teams?
Yes. Small teams can start with a simple workflow that runs tests and builds the application whenever code is pushed or a pull request is opened. More advanced deployment stages can be added as the project grows.
Does CI/CD guarantee zero downtime?
No. CI/CD can make deployments more consistent, but downtime depends on the application architecture, deployment strategy, database changes, infrastructure and recovery arrangements. Zero-downtime deployments require additional design and testing.
How do I roll back a failed deployment?
The process depends on how the application is deployed. It may involve redeploying the previous artifact or container image, switching traffic to a known-good release or restoring a compatible application and database state. Test the rollback procedure before relying on it in production.
Which CI/CD tool should I use?
Choose a tool that integrates with your repository and hosting environment and supports the workflow you need. GitHub Actions and GitLab CI/CD are convenient options for projects already using their respective platforms, while Jenkins can suit teams that require extensive self-hosted customisation.
Conclusion
CI/CD helps web developers move from manual, repetitive deployments to a more consistent and testable release process. By connecting Git repositories to automated checks, builds and controlled deployment steps, teams can identify problems earlier and make releases easier to manage.
Start with the fundamentals: maintain your code in Git, run automated tests, protect deployment credentials, use staging where appropriate and verify application health after release.
As your project grows, introduce more advanced practices such as versioned artifacts, container-based deployment, approval gates and tested rollback procedures.
The goal is not to automate every action immediately. It is to create a deployment workflow that is secure, repeatable and appropriate for your application's requirements.
Ready to improve your development workflow? Explore SteboHost developer hosting and review the available Git deployment options to see how your hosting environment can fit into your CI/CD strategy.
Written by Denis Makokha
SteboHost engineering and operations team. We write practical guides on hosting, domains, email and security for African businesses โ based on what we see in the field, not marketing copy.
Ready to get started?
Browse our hosting plans or contact our team for help choosing the right one.