Automatically deploy your Trellis-based WordPress site to staging
and production
environments on merge to staging
and main
branches respectively, and keep plugins, themes, and WordPress core up to date with Dependabot.
🔥 Based on setup-trellis-cli. This set of GitHub actions and workflows extend the functionality of that package to more tightly integrate with GitHub's native features.
- 🚀 Automatic (or manual) deployment to
staging
andproduction
environments using GitHub Actions when pull requests are merged to yourstaging
andmain
branches respectively. - 🔄 On-Demand one-way sync database and assets from
production
tostaging
. - 🔗 Maintains a history of GitHub Deployments and provides links to the current deployments in each environment.
- 🔑 Re-set deployment keys on-demand when you need to change who has access to
staging
orproduction
. - 📦 WordPress plugin, core, and theme updates managed with Dependabot.
- 📝 Optionally generates README.md with deployment status badges and setup instructions.
Click to expand
- 🌱 Sage 10 build test on pull request or on-demand (make sure your theme builds before you deploy it!).
- 🧪 Dry-run deployments to
staging
andproduction
environments on pull request or on-demand (confirm Trellis can deploy successfully without finalizing the deployment). ⏏️ Eject WordPress site from Bedrock and Trellis and prepare database and assets for migration to traditional WordPress hosting.
- A Trellis-based WordPress website.
- Provisioned remote servers for
staging
andproduction
environments.
NOTE: This project presumes your Trellis-based website and its staging
and production
environments are provisioned and deploying successfully.
- Copy the
.github
directory from this repository to your Trellis-based WordPress site's repository. - Refer to the Initial Setup instructions in
.github/README.md
to configure your GitHub repository for deployment.
These workflows are included and enabled by default.
🚀 Deploy to production
.github/workflows/deploy-production.yml
Automatically deploys to the production
environment when a pull_request
is merged
to the main
branch. This action can also be run manually from the "Actions" tab in GitHub.
When a deploy to production
is completed, the following occurs:
- A new release is created with the current date and time including site's database and uploads attached as artifacts (GitHub release size restrictions apply).
- A GitHub Deployment is created with a link to the environment.
🚀 Deploy to staging
.github/workflows/deploy-staging.yml
Automatically deploys to the staging
environment when a pull_request
is merged
to the staging
branch. This action can also be run manually from the "Actions" tab in GitHub.
When a deploy to staging
is completed, the following occurs:
- A new tag is created with the current date and time.
- A GitHub Deployment is created with a link to the environment.
🔄 Sync content production->staging
.github/workflows/sync-content-production-to-staging.yml
Copy the database and assets from the production
environment to the staging
environment overwriting the staging environment's database and assets.
🔑 Set Trellis deploy keys
.github/workflows/set-trellis-deploy-keys.yml
Updates the ssh keys used by Trellis to deploy to the staging
or production
environments. This action can be run manually from the "Actions" tab in GitHub.
This action replaces the current deploy keys with keys with keys defined in one or more of the following locations:
trellis/group_vars/all/users.yml
- GitHub secrets named
TRELLIS_DEPLOY_KEYS
- A new key entered manually when running the action
📝 Update README
.github/workflows/update-readme.yml
Updates the README.md with the current deployment status badges. This action can be run manually from the "Actions" tab in GitHub.
These example workflows are included to expand the functionality of this project. They are not enabled by default.
🧪 Dry-Run to Production
.github/examples/dryrun-production.yml
.github/workflows
directory to be used.
Performs a "dry-run" deployment to the production
environment, testing all aspects of a Trellis deployment without finalizing the deploy. Automatically deploys to the staging
environment when a pull_request
is opened
to the main
branch. This action can also be run manually from the "Actions" tab in GitHub.
🧪 Dry-Run to Staging
.github/examples/dryrun-staging.yml
.github/workflows
directory to be used.
Performs a "dry-run" deployment to the staging
environment, testing all aspects of a Trellis deployment without finalizing the deploy. Automatically deploys to the staging
environment when a pull_request
is opened
to the staging
branch. This action can also be run manually from the "Actions" tab in GitHub.
🌱 Sage 10 Build Test
.github/examples/sage10-build-test.yml
.github/workflows
directory to be used.
theme_slug
variable with your theme's slug.
Builds the Sage 10 theme and runs the theme's tests. Automatically runs when a push
is made to any branch.
⏏️ Eject Production
.github/examples/eject-production.yml
.github/workflows
directory to be used.
Exports a WordPress site built with Trellis from the production
environment for delivery to a traditional WordPress environment and attach artifacts to the workflow run for download. This action can be run manually from the "Actions" tab in GitHub.
🤖 WordPress core, plugin, and theme updates
Dependabot will check for updates to WordPress themes, plugins, and core as defined in site/composer.json
on a weekly basis and propose updates as pull requests to the staging
branch. You can change this behavior by editing the .github/dependabot.yml
file.