Kassem Husseine 2 years ago
Kassem@husseine.com #github

Automating Web App Deployment with GitHub

Learn how to set up a seamless continuous deployment workflow using GitHub Actions and FTP.

Introduction

This guide walks you through the procedure of deploying a web application automatically via FTP with the assistance of GitHub Actions. This workflow allows for continuous deployment, where updates to your GitHub repository are automatically pushed to your FTP server.

Requirements

  • GitHub account
  • GitHub repository containing the web app to deploy
  • Accessible server over FTP
  • Any standard web hosting service can be used.

Step 1 - Obtain FTP credentials and add them to GitHub

  1. Navigate to "Websites & Domains" in your control panel.
  2. Select the desired domain for hosting.
  3. Choose "FTP Access" under "Files & Databases".
  4. Click "Add an FTP Account" and fill in the necessary details.
  5. Note down the credentials for later use.
  6. Add these credentials to your GitHub repository under "Settings" > "Secrets and variables" > "Actions".

Step 2 - Configure the deployment workflow

  • Go to the "Actions" tab in your GitHub repository.
  • Select "Set up a workflow yourself".
  • Copy and paste the following code snippet:


name: FTP Deployment

on:
 push:
  branches:
   - main

jobs:
 deploy:
  runs-on: ubuntu-latest

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

   - name: Deploy over FTP
    uses: SamKirkland/FTP-Deploy-Action@3.2.0
    with:
     server: YOUR_SERVER_ADDRESS
     username: ${{ secrets.FTP_USERNAME }}
     password: ${{ secrets.FTP_PASSWORD }}
     server-dir: /your/server/folder
     local-dir: ./your/local/folder
  • Replace the placeholders with your actual details.
  • Commit the changes with an appropriate message.

Step 3 - Verify the GitHub Action

  1. Push updates to your main branch to initiate the workflow.
  2. Monitor the "Actions" tab in your repository to see the workflow in action.
  3. Once completed, verify the changes in your control panel.

Conclusion

You have now implemented an automatic deployment process using GitHub Actions. Updates to your repository will now automatically trigger an FTP push to your server. This automation simplifies deployment, as there is no need to manually transfer files.

1
982
Setting Up a LAMP Stack on a Linux Server

Setting Up a LAMP Stack on a Linux Server

1690892810.png
Kassem Husseine
2 years ago
Setting Up a Bitcoin Full Node with a Lightning Node

Setting Up a Bitcoin Full Node with a Lightning Node

1690892810.png
Kassem Husseine
2 years ago