Laravel deploy with GitHub Actions over FTPS, no SSH needed
· The AYT team · 6 min read

You can deploy a Laravel app automatically even on hosting without SSH: on every push, a GitHub Actions workflow runs composer install and npm run build, then uploads only the changed files over FTPS with the SamKirkland/FTP-Deploy-Action action. The method has two limits: it can't run artisan commands on the server, and the upload isn't instant. If your host deploys straight from Git on a webhook, that option is simpler.
What you need
- the project in a GitHub repository;
- an FTPS account on your host. Ideally a separate one that sees only the app's folder, so the password stored in GitHub doesn't open the whole account;
- on the server, once, before the first deploy: a complete
.envfile, thestoragefolders (storage/framework/cache/data,sessions,viewsandstorage/logs) and the domain pointed at the project'spublicfolder. For the last point, see the Laravel public folder.
Step 1: store the FTPS details in the repository's secrets
The password never goes in the workflow file. In GitHub, open the repository and go to Settings → Secrets and variables → Actions → New repository secret. Create three secrets:
FTP_SERVER, the FTP server's address;FTP_USERNAME, the FTPS account's username;FTP_PASSWORD, its password.
Step 2: create the workflow
In the project, create .github/workflows/deploy.yml:
name: Deploy to hosting
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
- name: PHP dependencies
run: composer install --no-dev --prefer-dist --no-interaction --optimize-autoloader
- uses: actions/setup-node@v7
with:
node-version: 24
- name: Build assets
run: npm ci && npm run build
- name: Upload over FTPS
uses: SamKirkland/FTP-Deploy-Action@v4.4.0
with:
server: ${{ secrets.FTP_SERVER }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
protocol: ftps
port: 21
server-dir: ./app/
exclude: |
**/.git*
**/.git*/**
**/node_modules/**
.env
storage/**
tests/**
What to adjust:
php-versionmust match the PHP version your site runs. Avendorbuilt on PHP 8.4 and uploaded to a site on PHP 8.2 stops the app at boot;server-diris the project folder, relative to the folder the FTPS account logs into, with a trailing/;protocol: ftpsmeans explicit FTPS, the most common kind, usually on port 21. If your host uses implicit FTPS, setftps-legacyand the port your host gives you.
Step 3: what you never upload
The exclude list matters more than the rest of the file:
.envstays on the server only. Uploading it from the repository would mean it's in git, which must not happen;storage/**holds the server's user uploads, sessions and logs. Uploading it would overwrite them;node_modulesisn't needed on the server, because the build output is already inpublic/build.
Don't run php artisan config:cache or optimize in the workflow. The cache would hold the GitHub machine's paths and settings, and on the server the app would fail with the 500 error after a deploy.
Step 4: the first deploy
For the first run, temporarily add dry-run: true to the upload step. The action logs which files it would upload, without uploading anything. Check that .env and storage aren't listed, remove the line and push.
The first deploy uploads the whole project, vendor included, which has thousands of files, so it can take several minutes. The action keeps a state file on the server, .ftp-deploy-sync-state.json, and on later deploys uploads only what changed.
Step 5: migrations and caches
FTPS only copies files. After a deploy that brings new migrations or configuration changes, the server needs:
php artisan migrate --force
php artisan optimize
php artisan queue:restart
Without SSH, run them from a panel tool that executes commands, if your host has one, or from a cron job added once and deleted afterwards. Don't build a public route that runs migrations: anyone who finds it can trigger them. More on what you can do without SSH in our guide to Laravel on hosting without SSH.
The limits of this method
- The upload takes time. While files are uploading, old and new files sit side by side on the server, and a request that lands then can fail.
- New code arrives before the migrations. Between the upload and
migrate, the app runs against an old database. - There's no rollback button. To go back, you revert in git and wait for another deploy.
For a brochure site or an internal app, this method is enough. For a shop taking orders all day, a deploy that builds the new version separately and switches to it at once is safer.
The simpler option on AYT: deploy on a webhook
On AYT, a Laravel site set up with the Laravel Toolkit deploys from Git on the server and doesn't need GitHub Actions. The steps:
- In the Laravel Toolkit, open Deployments and fill in Repository and Branch. For a private repository, use the public key under Deploy key, added in GitHub as a read-only deploy key, or an Access token for an
https://address. - Click Set up the webhook and copy the address (Payload URL) and the secret.
- In GitHub, under Settings → Webhooks → Add webhook, paste the address, choose content type
application/json, paste the secret and keep only the push event.

From then on, every push to the chosen branch starts a deploy. The server clones the code into a new release and runs the deploy script, which you can edit (by default composer install, an asset build if there's a package.json, php artisan migrate --force and php artisan optimize). Only then does it switch the site to the new release and check the /up route; if the check fails, it puts the previous release back. Queue workers restart on their own, the last 20 deploys stay in the history with their logs, and Roll back takes you to the previous release. Test branches can have their own environments at <name>.your-domain.com. All the tools are described under apps.
