GitHub to Automation

Advertisement now provide the GitHub action support to all the sites which are hosted on with Business or eCommerce plan.

The integration of this automation process is very easy.

Lets see step by step, How I have setup GitHub automation to my site

Create FTP Details Create FTP Details

If you have a account then you can visit to the URL:<SITENAME>

E.g. I found my hosting details at URL:

Below is the screenshot of how it looks like:

GitHub to Automation 1
Hosting Configuration

Here, You can see the username and if you don’t remember the password then simply reset it by clicking on reset password button.

You can also read more about SFTP on

Top ↑

Create GitHub Repository Create GitHub Repository

So, I have created a GitHub repository:

NOTE: I have set this repository as private. But, This automation will work with both private and public repositories.

After creating a git repository create two branches.

  • main – For default usage.
  • – For WordPress automation

Now, We are ready to set the GitHub actions.

Top ↑

What are GitHub Actions? What are GitHub Actions?

GitHub actions are basically provide a way to perform some action after doing any git action.

E.g. we can perform GitHub actions as:

  • After merge in master do xyz thing.
  • After create new tag do abc something

We are creating a Github action which perform as:

After we merge the PR from main to then the content from our Git repository move from GitHub repository to our WordPress hosting.

Read more about GitHub actions.

Top ↑

Create Deploy GitHub Action Create Deploy GitHub Action

We need to set the GitHub action in our main branch. So,

  • Create directories .github/workflows/
  • Create file
  • Copy and paste below code within it:
name: Deploy to
branches: [ ]
name: FTP-Deploy-Action
runs-on: ubuntu-latest
– uses: actions/checkout@master
fetch-depth: 2
– name: FTP-Deploy-Action
uses: Automattic/FTP-Deploy-Action@3.0.1
ftp-server: s
ftp-username: ${{ secrets.FTP_USER }}
ftp-password: ${{ secrets.FTP_PASSWORD }}
known-hosts: "\ ssh-rsa AAAAB3NzaC1yc2EAAAADAQAB\

In our GitHub action we need to set our FTP username and password, BUT, those are with GitHub secretes.

In GitHub we can stare the sensitive data like authentication key, password etc. in GitHub secrets.

Visit to your GitHub repository /settings/secrets/actions/new

E.g. My secrets URL is below:

Now, We need to set FTP_USER and FTP_PASSWORD something like:

GitHub to Automation 2
GitHub to Automation 7

NOTE: The password from above screenshot is wrong. So, Don’t try to hack my site 😛

After adding both keys you can see:

GitHub to Automation 3
GitHub to Automation 8

Now, Lets copy the files and folders which we want for our automation.

Top ↑

Copy files to GitHub Repository Copy files to GitHub Repository

Now, Lets clone the repo on local computer

$ git clone <GIT_REPO_URL>
$ git fetch --all
$ git checkout main && git pull
$ git checkout && git merge main
$ git push --set-upstream origin

Now, We need a GitHub repository to copy the folders from /wp-content/ which we want for automation.

In My case, I have set below directories:

  • /wp-content/mu-plugins/
  • /wp-content/plugins/
  • /wp-content/themes/

NOTE: Now, We need to copy all the directories with the help of FTP client. I am using the WinSCP to copy all my files and folders but you can use any other FTP client e.g FileZilla.

Then, After copy the files commit the changes and push to the main branch.

Below is the screenshot in which you can see I have just copy above folders.

GitHub to Automation 4
GitHub to Automation 9

NOTE: WordPress hosting root directory contain some directories with a (?) mark. So, Avoid them.

Top ↑

Deploy to Deploy to

Now, We are in last step.

  • Create a PR from main to
  • Merge PR
  • Wait for the GitHub action from <GitHub Repo>/actions
GitHub to Automation 5
GitHub to Automation 10


You can see my first deploy takes 2 hours 45 minutes and 35 seconds because of there was lot of files and folders in my /wp-content/ directory.

Then, I had did the second change which was:

GitHub to Automation 6
GitHub to Automation 11

And, The second deploy takes ONLY 58 seconds.

Pretty awesome.

Try it yourself and let me know you experience.

You can also read the official article at Automatically Deploy to Using GitHub Actions

Leave a Reply