DEV Community

๐Ÿš€ How to Automate Laravel Deployments to Shared Hosting Using GitHub Actions + FTP

Manually deploying Laravel projects to shared hosting via FTP is slow, risky, and time-consuming. The goal is to automate deployments on shared hosting without SSH access when pushing code to the main branch. This is achieved using Laravel, GitHub, GitHub Actions, and FTP access. FTP credentials are first stored as secure secrets within the GitHub repository settings. A GitHub Actions workflow file is then created to automate the deployment process. This workflow checks out the code and uses the FTP-Deploy-Action to upload files. The workflow excludes specified directories like node_modules and vendor, and the .env file. Pushing code to the main branch triggers the automated deployment through FTP. This process saves time and eliminates manual file management, improving deployment efficiency. GitHub Actions and FTP provide a reliable deployment solution for shared hosting environments.
favicon
dev.to
dev.to
Create attached notes ...