<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Jonathan Lam Seck</title>
    <description>The latest articles on Forem by Jonathan Lam Seck (@jonathan_lamseck).</description>
    <link>https://forem.com/jonathan_lamseck</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3385501%2Fa6eeec3e-acd2-44c9-b5a2-9fc498042793.jpg</url>
      <title>Forem: Jonathan Lam Seck</title>
      <link>https://forem.com/jonathan_lamseck</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jonathan_lamseck"/>
    <language>en</language>
    <item>
      <title>🚀 How to Automate Laravel Deployments to Shared Hosting Using GitHub Actions + FTP</title>
      <dc:creator>Jonathan Lam Seck</dc:creator>
      <pubDate>Thu, 24 Jul 2025 16:09:31 +0000</pubDate>
      <link>https://forem.com/jonathan_lamseck/how-i-automated-laravel-deployments-to-shared-hosting-using-github-actions-ftp-2go6</link>
      <guid>https://forem.com/jonathan_lamseck/how-i-automated-laravel-deployments-to-shared-hosting-using-github-actions-ftp-2go6</guid>
      <description>&lt;p&gt;Deploying Laravel projects to shared hosting manually — via tools like FileZilla — can be time-consuming, error-prone, and inefficient. I recently faced this challenge while managing multiple Laravel projects (including a school management system) and decided to finally automate the process.&lt;/p&gt;

&lt;p&gt;In this post, I’ll share how I automated my deployment pipeline using GitHub Actions + FTP, even on a shared hosting environment (like cPanel or DirectAdmin) — no SSH access needed!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧱 The Problem&lt;/strong&gt;&lt;br&gt;
Manually deploying files via FileZilla was:&lt;/p&gt;

&lt;p&gt;Slow (uploading file-by-file)&lt;br&gt;
Risky (easy to miss files or overwrite the wrong thing)&lt;br&gt;
Time-consuming (especially during multiple updates per day)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;✅ The Goal&lt;/strong&gt;&lt;br&gt;
I wanted a solution where:&lt;/p&gt;

&lt;p&gt;Code is automatically deployed when I push to main&lt;br&gt;
I can avoid uploading node_modules/, vendor/, or .env&lt;br&gt;
No SSH is required&lt;br&gt;
It's easy to set up and secure&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔧 The Stack&lt;/strong&gt;&lt;br&gt;
Laravel (PHP framework)&lt;br&gt;
GitHub for source control&lt;br&gt;
GitHub Actions for automation&lt;br&gt;
FTP access (via DirectAdmin or cPanel)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🚀 The Solution: GitHub Actions + ftp-deploy Action&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Set FTP Credentials as GitHub Secrets&lt;/strong&gt;&lt;br&gt;
In your GitHub repo:&lt;/p&gt;

&lt;p&gt;Go to Settings &amp;gt; Secrets &amp;gt; Actions&lt;/p&gt;

&lt;p&gt;Add:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;FTP_HOST = ftp.yourdomain.com&lt;br&gt;
FTP_USERNAME = your FTP username&lt;br&gt;
FTP_PASSWORD = your FTP password&lt;br&gt;
FTP_TARGET_DIR = /public_html/your-laravel-folder/ (dont't forget the / at the end of your path)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Create Your GitHub Action Workflow&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In .github/workflows/ftp-deploy.yml:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name: 🚀 FTP Deploy Laravel App

on:
  push:
    branches:
      - main

jobs:
  ftp-deploy:
    name: Deploy via FTP
    runs-on: ubuntu-latest

    steps:
      - name: 📥 Checkout code
        uses: actions/checkout@v3

      - name: 🔒 FTP Deploy
        uses: SamKirkland/FTP-Deploy-Action@v4.3.4
        with:
          server: ${{ secrets.FTP_HOST }}
          username: ${{ secrets.FTP_USERNAME }}
          password: ${{ secrets.FTP_PASSWORD }}
          local-dir: ./
          server-dir: ${{ secrets.FTP_TARGET_DIR }}
          exclude: |
            **/.git*
            **/.env
            **/node_modules/**
            **/vendor/**
            **/tests/**
            storage/
          dry-run: false

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;💬 Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This solution saved me hours of manual work. Now, I simply push to main, and the code is live. If you're stuck using shared hosting without SSH, GitHub Actions + FTP is a reliable and modern way to automate your Laravel deployments.&lt;/p&gt;

&lt;p&gt;Let me know if you try it or need help setting it up!&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>webdev</category>
      <category>githubactions</category>
      <category>php</category>
    </item>
  </channel>
</rss>
