1. Home
  2. Docs
  3. Simply Static
  4. GitHub

GitHub

The GitHub integration of Simply Static provides a lot of benefits compared to the classic ZIP and local directory exports:

  • version control (no more backups)
  • deployment on Github Pages, Cloudflare Pages, Vercel, Netlify, FTP, AWS and CDNs
  • automatic push-to-deploy changes from WordPress to your static website

It’s also the recommended way to run Simply Static for a full-featured way of running a static version of your WordPress website.

Setup

Go to Simply Static->Settings->Github.

You should see a couple of fields that we will fill out step by step now.

GitHub 1

Don’t worry when you have not worked with GitHub and version control before. Simply Static will handle pretty much everything for you. You just need an account and an access token to allow Simply Static to take action.

GitHub Account and Personal Access Token

Head over to https://github.com/join and create an account.

After that, we have to create a personal access token. You can find that in your account, click on your profile picture on the right corner of GitHub, it opens a submenu then choose “Settings”

Then click on “developer settings” on the left sidebar:

GitHub 2

Then choose “Personal Access Token” and click on “Generate new token”:

GitHub 3

Now we have to configure the scopes that the personal access zoken is allowed to use.

Simply Static need the privileges to read and write repositories, delete repositories, and the user settings (to verify actions). I would also recommend activating “Workflows” as this will be integrated into Simply Static in the future to further automate your deployment.

The full configuration should look like that:

GitHub 4

Click “Generate token” and copy the generated code to add it to Simply Static.

Completing the configuration

Now we can head back to the Simply Static settings and finish up the configuration. Go to Simply Static -> Settings -> Github and add your user name and the personal access token.

GitHub 5

Add a name for a repository. This does not need to be the name of your website, it can be pretty much everything. You can decide if your repository should be public or private. Public repositories can be seen by everyone, private repositories are limited to you and everyone you grant access to.

You can add a name for the branch, but you don’t have to – Simply Static uses main as the default one automatically. This setting can depend on your used deployment option.

When you are ready hit “Save Changes”.

Create a repository

Now you should see an additional button next to “Save changes” called “Add repository” – click on it. If your provided details are correct you will see a link next to “Link to your repository” otherwise you get an error message that provides you the solution to your problem.

GitHub 6
GitHub 7

That’s it. You have successfully connected Simply Static with GitHub. Make sure you have configured “Github” as your delivery method in Simply Static -> Settings -> General and the next time click “Generate” in Simply Static -> Generate it will commit your files directly to GitHub.

It also checks if there was a modification before updating a file to minimize the number of API requests done and speed up the generation.

GitHub Actions

GitHub Actions are an easy and powerful way to automate your deployment when not using a static hosting proivder. There are hundreds of free GitHub Actions you can use to automate the entire process from deployment, to code analysis, to messaging in Slack and more, but let’s keep it simple here.

For this introduction, we will be using the following GitHub Action to deploy our static website to your SFTP-Server: https://github.com/SamKirkland/FTP-Deploy-Action

Action Settings

Go to the repository of your static websites then navigation to Settings -> Actions.

GitHub 8

You can leave the settings as default or change the permissions of the actions that are allowed to run.

Create workflows

Now head back to your repository and click the button “Add file -> Create new file”.

GitHub 9

The new file will have the following path:

.github/workflows/main.yml

You will see that GitHub will autocomplete the breadcrumb to make sure you are matching it correctly.

GitHub 10

Now we can copy and paste the content of the YAML file provided from the SFTP action as seen in the next screenshot. The only thing we need to change here is the SFTP server, the SFTP user, and the SFTP password.

Please do not add your password here directly, we use secrets here (we cover that next). Click “Commit new file” and we can move forward.

GitHub 11

Secrets

To store sensitive data (like passwords) in your GitHub repository you have to use secrets. In our example, we used a placeholder called:

${{ secrets.ftp_password }} 

Go to your repository then Settings->Secrets and click on “New repository secrets”.

GitHub 12

Add the placeholder and the value it should be replaced with and click “Add secret”

GitHub 13

Congrats that’s it for the setup now. An action get triggered everytime you push to your repository. As Simply Static handles all of that for you, you don’t have to worry about that.

Monitor Actions

If you like to monitor your actions, you can check the details in “Actions” tab within your repository. It provides detailed logs, an overview of all running and planned actions and more:

GitHub 14