# Trellis Deployment with GitHub Actions

**URL:** https://discourse.roots.io/t/trellis-deployment-with-github-actions/25410
**Category:** trellis
**Tags:** deploys, trellis-cli, trellis
**Created:** 2023-05-23T18:37:57Z
**Posts:** 4

## Post 1 by @MWDelaney — 2023-05-23T18:37:57Z

Introducing Trellis GitHub Deployment.

# :rocket: Trellis GitHub Deployment

Automatically deploy your [Trellis](https://roots.io/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.

## Features

- :rocket: **Automatic (or manual) deployment** to `staging` and `production` environments using [GitHub Actions](https://github.com/features/actions) when pull requests are merged to your `staging` and `main` branches respectively.
- :counterclockwise_arrows_button: **On-Demand one-way sync** database and assets from `production` to `staging`.
- :link: **Maintains a history of [GitHub Deployments](https://docs.github.com/en/rest/reference/repos#create-a-deployment)** and provides links to the current deployments in each environment.
- :key: **Re-set deployment keys on-demand** when you need to change who has access to `staging` or `production`.
- :package: **WordPress plugin, core, and theme updates** managed with [Dependabot](https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/about-dependabot-version-updates).
- :memo: **Optionally generates README.md** with deployment status badges and setup instructions.

### Optional Additional Workflows

> **Click to expand**
>
> - :seedling: **Sage 10 build test** on pull request or on-demand (make sure your theme builds before you deploy it!).
> - :test_tube: **Dry-run deployments** to `staging` and `production` environments on pull request or on-demand (confirm Trellis can deploy successfully without finalizing the deployment).
> - :eject_button: **Eject WordPress site** from Bedrock and Trellis and prepare database and assets for migration to traditional WordPress hosting.

> **[GitHub - MWDelaney/trellis-github-deployment: GitHub Actions and workflows to automate...](https://github.com/MWDelaney/trellis-github-deployment)**
>
> GitHub Actions and workflows to automate deployment of a Roots/Trellis project to staging and production environments.

---

## Post 2 by @MWDelaney — 2023-05-25T12:33:31Z

Thanks for looking at this y’all! This is an open-source project, and reflects my typical setup, which is as close as possible to the Trellis documentation. I welcome suggestions, pull requests, and discussion for how to make it more flexible and functional!

---

## Post 3 by @swalkinshaw — 2023-05-25T18:54:56Z

Thanks for sharing this @MWDelaney. I know how much work into it!

One suggestion I have is to add a note about the usage of `setup-trellis-cli` in the README. eg: How it’s additive (and built on it), and why someone would use yours over the basic `setup-trellis-cli`.

---

## Post 4 by @intelligence — 2023-06-01T09:17:09Z

This is awesome, thanks for sharing!
