The last few days I tried GitHub’s solution for deploying my website, that gets triggered after a Git commit. I have no VPS , just a simple hosting plan with FTP access to upload files to a public_html directory.
I use Visual Studio Code for developing, Git for deploying, and FTP for uploading changed files. Sometimes I even used the DirectAdmin portal my hosting provider provided for uploading files and folders.
Last night I decided to make things easier and found a simple solution, with help of this article. It’s useful to read this first.
After I made changes to my website with Visual Studio Code, I use Git to push my repository to Github. I use GitHub Actions to upload sync the changed files to the server. So I only have FTP access to this server. My workflow file looks like this:
on:
push:
branches: [ master ]
name: ๐ Deploy website on push
jobs:
web-deploy:
name: ๐ Deploy
runs-on: ubuntu-latest
steps:
– name: ๐ Get latest code
uses: actions/checkout@v3
– name: ๐ Sync files
uses: SamKirkland/FTP-Deploy-Action@v4.3.4
with:
server: ftp.domain.com
username: sosxo@domain.com
password: ${{ secrets.FTP }}
exclude: |
*/.git
*/.git/**
With this setup, my website gets updated only when I merge my feature branch into the master branch. Neat.
This made me think; It’s been a while since I made actual pipelines, for different stages. A workflow is not the same as a pipeline, but I would like to get into building pipelines again for work.
Leave a Reply