Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/munya-marinda/deploy-from-github-to-cpanel-using-cicd
This repository demonstrates how to set up Continuous Integration and Continuous Deployment (CICD) to deploy your website from GitHub to a cPanel server automatically whenever changes are pushed to the 'main' branch.
https://github.com/munya-marinda/deploy-from-github-to-cpanel-using-cicd
cicd cpanel github-actions
Last synced: about 1 month ago
JSON representation
This repository demonstrates how to set up Continuous Integration and Continuous Deployment (CICD) to deploy your website from GitHub to a cPanel server automatically whenever changes are pushed to the 'main' branch.
- Host: GitHub
- URL: https://github.com/munya-marinda/deploy-from-github-to-cpanel-using-cicd
- Owner: Munya-Marinda
- Created: 2024-11-15T08:12:59.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-11-15T08:17:44.000Z (about 1 month ago)
- Last Synced: 2024-11-15T09:25:39.472Z (about 1 month ago)
- Topics: cicd, cpanel, github-actions
- Language: HTML
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Deploy from GitHub to cPanel using CICD - Medium
This repository demonstrates how to set up Continuous Integration and Continuous Deployment (CICD) to deploy your website from GitHub to a cPanel server automatically whenever changes are pushed to the `main` branch.
TUTORIAL: [Watch On YouTube](https://www.youtube.com/watch?v=W70fWpcHMzc&t=650s)
![Screenshot 2024-11-15 101229](https://github.com/user-attachments/assets/79c5e62f-b083-41e7-8ea9-f9f04baff6e7)
## Table of Contents
- [Overview](#overview)
- [Setup Instructions](#setup-instructions)
- [Workflow Explanation](#workflow-explanation)
- [Sample Code](#sample-code)
- [Secrets Configuration](#secrets-configuration)
- [License](#license)---
## Overview
This project provides:
- An example of using GitHub Actions for automating FTP deployments.
- A simple HTML template to use as an example website.---
## Setup Instructions
### Step 1: Clone the Repository
Clone the repository to your local machine:
```bash
git clone https://github.com//deploy-from-github-to-cpanel-using-cicd.git
```### Step 2: Add Your HTML Files
Replace the `index.html` file in the repository with your actual website content.
### Step 3: Set Up GitHub Secrets
1. Navigate to your GitHub repository.
2. Go to **Settings > Secrets and variables > Actions > New repository secret**.
3. Add the following secrets:
- `FTP_HOST`: The FTP host (e.g., `ftp.yourdomain.com`).
- `FTP_USERNAME`: The FTP username.
- `FTP_PASSWORD`: The FTP password.
- `FTP_DIR`: The directory on your server where the files should be uploaded (e.g., `/public_html`).### Step 4: Push Changes
Push your code to the `main` branch, and GitHub Actions will handle the deployment automatically.
---
## Workflow Explanation
The GitHub Actions workflow (`.github/workflows/master.yml`) performs the following steps:
1. **Trigger on Push**: The workflow is triggered whenever changes are pushed to the `main` branch.
2. **Checkout Code**: Retrieves the latest code from the repository.
3. **Sync Files**: Uses the `SamKirkland/FTP-Deploy-Action` to deploy files via FTP.### Workflow File
```yaml
name: Deploy Websiteon:
push:
branches:
- mainjobs:
web-deploy:
name: Deploying to Productionruns-on: ubuntu-latest
steps:
- name: Get latest code
uses: actions/checkout@v2- name: Sync files
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.FTP_HOST }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
server-dir: ${{ secrets.FTP_DIR }}
```---
## Sample Code
### `index.html`
A basic HTML file to serve as the project's homepage:
---
## Secrets Configuration
The deployment relies on the following secrets:
- `FTP_HOST`: FTP server address.
- `FTP_USERNAME`: FTP login username.
- `FTP_PASSWORD`: FTP login password.
- `FTP_DIR`: Target directory on the FTP server.Set these in your repository under **Settings > Secrets and variables > Actions**.
---
## License
This project is licensed under the MIT License. Feel free to use and modify it as needed.
---
## Author
Created by [Your Name](https://github.com/