Automatic Deployment via good ol’ FTP

Since their release, GitHub actions are on my long-term todo list for increasing automation of my workflows. Thanks to DEVs GitHub Actions Hackathon, I’m finally tackling this topic.

My Workflow

It’s the FTP-Deploy-Action by Sam Kirkland which utilizes Git-ftp. I’m mostly creating Vue.js applications with the Vue CLI — so my normal workflow always looked like this:

  1. ➕ Make code changes (e.g. fixing an important security issue)
  2. 🔨 Test code changes
  3. ✅ Commit these changes to the repository
  4. 🔁 Create new build files optimized for production using vue-cli-service build
  5. ❌ Delete old build files from production server
  6. ⏫ Upload new build files to production server
  1. ➕ Make code changes (e.g. fixing an important security issue)
  2. 🔨 Test code changes
  3. ✅ Commit these changes to the repository
  4. 🔁 Create new build files optimized for production using vue-cli-service build
  5. Lean back and let the GitHub FTP-Deploy-Action do the rest

Configuration

So, how can you set up this FTP-Deploy-Action? You simply have to create a configuration file called ftp-deploy.yaml under your-repo/.github/workflows/. This is what my configuration looks like:

on:
push:
paths:
- 'dist/*'
name: FTP Deploy
jobs:
FTP-Deploy-Action:
name: FTP-Deploy-Action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.1.0
with:
fetch-depth: 2
- name: FTP-Deploy-Action
uses: SamKirkland/FTP-Deploy-Action@master
with:
ftp-server: ${{ secrets.ftp_server }}
ftp-username: ${{ secrets.ftp_username }}
ftp-password: ${{ secrets.ftp_password }}
local-dir: dist/

Additional Resources / Info

Wrap it up

So we saw that it’s fairly simple to let GitHub deploy you build files automatically via FTP. You just need to create one configuration file and set a few repository secrets.

--

--

creator. developer. consultant.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store