GitHub Actions and workflows to automate deployment of a Roots/Trellis project to staging and production environments.
MIT License
This Trellis-based WordPress project uses GitHub Actions for continuous deployment.
Deployment occurs automatically from this GitHub repository using GitHub Actions.
This project deploys to the staging
and production
environments when a pull_request
is merged
to staging
or main
branches respectively.
GitHub Deployments maintain a history of deployments and provide links to the current deployments in each.
Note: these instructions presume your staging
and production
environments (servers) and DNS are already configured.
Deployment relies on 4 GitHub secrets:
Modify and run the following to generate these secrets:
trellis key generate && gh secret set ANSIBLE_VAULT_PASSWORD -b $(cat trellis/.vault_pass) && gh secret set TRELLIS_SITE_SLUG -b example.com
TRELLIS_DEPLOY_SSH_PRIVATE_KEY
- A private key used by GitHub to connect to your environments.TRELLIS_DEPLOY_SSH_KNOWN_HOSTS
- known_hosts
keys for your environments.ANSIBLE_VAULT_PASSWORD
- Your new Trellis project's vault password.TRELLIS_SITE_SLUG
- The slug from your new Trellis project's wordpress_sites.yml
file.From your site
directory, run:
trellis alias
And update site/wp-cli.yml
as instructed.
Settings
-> Actions
-> General
-> Workflow Permissions
.Run the following:
trellis provision staging && trellis provision production
trellis init
trellis up