A template for developing a WordPress site locally in Visual Studio Code and deploying to Flywheel.
This template contains the necessary configuration to set up a WordPress site:
- in development, using local containers with Visual Studio Code and Docker
- in production, using GitHub Actions to deploy changes to Flywheel
If you're just getting started on a new site, click the "Use this template" button. See these instructions in the GitHub Docs for more information.
If you already have a repository you'd like to deploy to Flywheel, create a workflow file in your repository and copy the contents of this workflow into it.
Optionally, you can copy the .devcontainer
directory into your repository if you want to use the Visual Studio Code Remote Containers extension.
Once you have a repository with the GitHub Actions worfklow, you'll need to configure it with your SFTP details.
This workflow is set up to deploy a wp-content
directory to sftp://sftp.flywheelsites.com/[site-owner]/[site-name]/wp-content
, where [site-owner]
is the Flywheel user or Organization that owns the site, and [site-name]
is the name/slug of the site.
The wp-content
directory is chosen as the destination of the deployment since Flywheel, as a Managed WordPress host, automatically manages core WordPress files; as such, only the wp-content
directory is relevant for deployments.
In the GitHub Actions workflow file, update these env
values:
This is the folder in your git repository that will be uploaded to your site on Flywheel.
By default, this workflow assumes that the root of the repository is the wp-content
directory, with themes
and plugins
as top-level folders in the repository (as exemplified in this template). If wp-content
is in a sub-directory of your repository, be sure to update SFTP_SOURCE
to point to it.
SFTP_SOURCE: ./
SFTP_SOURCE: ./path/to/wp-content
This is the Flywheel user or Organization that owns the site. Keep in mind that this may be different from your Flywheel username if the site is part of an Organization or you are a collaborator on the Flywheel site.
SFTP_OWNER: my-username
SFTP_OWNER: org-my-organization-name
This is the kebab-cased version of the site name (sometiems called a "slug"), as you would see in your SFTP client. This corresponds to the site name as configured in the Flywheel Dashboard.
SFTP_SITE: my-site-name
This is the username you use to log into Flywheel. Keep in mind that this may be different from the site owner if the site is part of an Organization or you are a collaborator on the Flywheel site.
SFTP_USER: my-username
Do not configure your SFTP password in the GitHub Actions workflow file. It is dangerous to put your password in plaintext configuration files, even if your repository is private. Instead, configure a repository secret named SFTP_PASSWORD
.