Articles

Deploying to a server via SSH and Rsync in a Github Action

I wanted to use Github Actions to deploy zellwk.com — when I push a commit into Github, I want Github Actions to build my site and deploy to my Digital Ocean server.

The hardest part of this process is deploying to the server with SSH and rsync. I tried various Github actions like SSH Deploy and SSH Action, but I couldn’t get the permissions to work for A LONG TIME.

I found most articles about Github actions and SSH didn’t help me much. I got stuck with debugging for a few days before I finally figured out how to make the process work.

Today, I want to share the exact steps to deploy via rsync and SSH. This process works for any server, even if you don’t use Digital Ocean.

Understanding how to use Github Actions

Github Actions is a Continuous Integration (CI) + Continuous Deployment (CD) tool by Github.

CI and CD are bombastic terms, but they simply mean the following:

  • Continuous Integration: People push to a Git repository and the code gets tested automatically.
  • Continuous Delivery: The pushed code (ideally tested and bug-free) is then pushed into the server so it becomes live for users.

Although Github Actions is one of the many CI + CD Tools out there, it’s probably the simplest one to use (in my experience). Unfortunately, the Github Actions docs is a complete mess — they keep pointing you to different pages, expecting you to read everything (and understand everything) when you’re still trying to set up your first action.

Today I want to share the basics of using Github Actions so it becomes easy for you to use it.

How to use Reduce in JavaScript

reduce is an array method that helps you convert an array into a single value. It looks like this:

const callback = (accumulator, currentValue, index) => {
// return something here
}
const result = array.reduce(callback, initialValue)
  • initialValue is the value you want to start with.
  • accumulator is the value returned from the previous iteration. It will be initialValue for the first iteration.
  • currentValue is array item in the current iteration.

Let’s go through some examples.

Choosing between Netlify, Vercel and Digital Ocean

A while back, I jumped onto the hype train and tried to host Learn JavaScript’s marketing page on Netlify — I wanted to join the cool kids. After getting charged for it, I switched to Vercel and I got charged for it (again). I finally went back to good old Digital Ocean.

In this article I want to detail the differences between hosting on Netlify, Vercel, and Digital Ocean, along with what I experienced in the process.

How to write super simple and useful regular expressions for the real world

Regular expressions are HARD! They look so complicated, they’re turn me off completely most of the time. Sometimes I wished I was smarter so I can use them more effectively.

While working on Learn JavaScript, I noticed that using regular expressions effectively doesn’t mean you need to write complicated regex. You can write super simple regex that solves a ton of problems.

I’m going to show you a real example.

Year End Review — 2020

Hello! I want to begin the year with a year-end review again. I like doing these because it gives me a solid sense of where I am today versus where I was last year.

Giving away 10 copies of Learn JavaScript

I want to start 2021 on a good note by giving away 10 copies of my JavaScript course, Learn JavaScript. This course will help you become great at JavaScript within a short span of time. The usual price for this course is $495, so I’m gonna give away $4950 worth of value.

Rik Schennink is also joining me and giving away 5 lifetime Hobby license for his amazing Image Editor plugin, Doka. Each hobby plan is priced at $149, each year, so Rik is giving away a ton too!

Case Conversion in JavaScript

I got fed-up searching Google for case conversion utilities. The useful ones I found (Voca and change-case) both require an environment that allows me to use npm.

But I was using Vanilla JavaScript. I did not want to include any toolchains in this project, and I’m reluctant to send an asynchronous request to download a module just for case-conversion.

So I decided to write a set of conversion utilities myself.

It’s simpler than I thought.

Why we should use Ergonomic keyboards

Normal keyboards create tension in the wrists, which eventually lead to backaches. In this article, I explain how that connection happens and why we should use ergonomic keyboards.

Hold on while i sign you up…

🤗
Woohoo! You’re in!
Now, hold on while I redirect you.