Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mwdelaney/trellis-github-deployment
GitHub Actions and workflows to automate deployment of a Roots/Trellis project to staging and production environments.
https://github.com/mwdelaney/trellis-github-deployment
deployment-automation github-actions trellis trellis-cli wordpress
Last synced: 14 days ago
JSON representation
GitHub Actions and workflows to automate deployment of a Roots/Trellis project to staging and production environments.
- Host: GitHub
- URL: https://github.com/mwdelaney/trellis-github-deployment
- Owner: MWDelaney
- License: mit
- Created: 2023-03-29T15:02:45.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-12T18:08:26.000Z (2 months ago)
- Last Synced: 2024-10-19T01:31:53.543Z (27 days ago)
- Topics: deployment-automation, github-actions, trellis, trellis-cli, wordpress
- Homepage:
- Size: 110 KB
- Stars: 27
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: .github/README.template.md
- Funding: FUNDING.yml
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# example.com
This [Trellis](https://roots.io/trellis/)-based WordPress project uses GitHub Actions for continuous deployment.
[![Deploy to staging](https://github.com/MWDelaney/example.com/actions/workflows/deploy-staging.yml/badge.svg?branch=staging)](https://github.com/MWDelaney/example.com/actions/workflows/deploy-staging.yml) [![Deploy to production](https://github.com/MWDelaney/example.com/actions/workflows/deploy-production.yml/badge.svg)](https://github.com/MWDelaney/example.com/actions/workflows/deploy-production.yml)
## Deployment
Deployment occurs automatically from this GitHub repository using [GitHub Actions](https://github.com/features/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.
[See the current deployments](https://github.com/MWDelaney/example.com/deployments)
Initial Setup
_Note: these instructions presume your `staging` and `production` environments (servers) and DNS are already configured._
### System Requirements
* [Trellis CLI](https://github.com/roots/trellis-cli)
* [Github CLI](https://cli.github.com)### 1. Create GitHub Secrets
Deployment relies on 4 GitHub secrets:
Modify and run the following to generate these secrets:
```bash
trellis key generate && gh secret set ANSIBLE_VAULT_PASSWORD -b $(cat trellis/.vault_pass) && gh secret set TRELLIS_SITE_SLUG -b example.com
```#### Secrets
* `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](https://roots.io/trellis/docs/vault/).
* `TRELLIS_SITE_SLUG` - The slug from your new Trellis project's `wordpress_sites.yml` file.### 2. Generate Trellis aliases
From your `site` directory, run:
```bash
trellis alias
```And update `site/wp-cli.yml` as instructed.
### 3. Grant workflow permissions
1. In this repository, navigate to `Settings` -> `Actions` -> `General` -> `Workflow Permissions`.
2. Enable "read and write" permissions.### 4. Reprovision your environments to allow GitHub's deploy key
Run the following:
```bash
trellis provision staging && trellis provision production
```## Development
1) Clone this repository locally
2) In the repository directry, run `trellis init`
3) In the repository directory, run `trellis up`