Skip to content

Commit

Permalink
Add support for deploying to a feature install
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanshoover committed Jul 29, 2019
1 parent 91b3b7d commit 3a9d176
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 78 deletions.
13 changes: 12 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: |
to test a site repo at every stage and deploy the site to WP Engine environments.
orbs:
wpengine: ryanshoover/wpengine@0.2.4
wpengine: ryanshoover/wpengine@0.3

workflows:
version: 2
Expand Down Expand Up @@ -46,6 +46,17 @@ workflows:
only:
- master
- production
- wpengine/build_deploy:
name: deploy-feature
environment: thenameofmyfeatureinstall
requires:
- wpengine/lint
- wpengine/codeception
filters:
branches:
only:
- /feat-.*/


regression:
jobs:
Expand Down
69 changes: 5 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,74 +44,15 @@ Build and deploy the codebase to a WP Engine environment

## Sample CircleCI Config

This is a sample setup for deploying to a WP Engine site.

`.circleci/config.yml`

```yml
version: 2.1

orbs:
wpengine: ryanshoover/[email protected]

workflows:
version: 2

build_test_deploy:
jobs:
- wpengine/lint
- wpengine/codeception

- wpengine/build_deploy:
name: deploy-development
environment: development
requires:
- wpengine/lint
- wpengine/codeception
filters:
branches:
only: development

- wpengine/build_deploy:
name: deploy-staging
environment: staging
requires:
- wpengine/lint
- wpengine/codeception
filters:
branches:
only: staging

- wpengine/build_deploy:
name: deploy-production
environment: production
requires:
- wpengine/lint
- wpengine/codeception
filters:
branches:
only:
- master
- production

regression:
jobs:
- wpengine/backstop:
config: tests/_backstop/index.js
filters:
branches:
only:
- staging
See the [sample circleci config file](.circleci/config.yml) for a copy-paste solution to get you up and running.

```

Environment Variables
## Environment Variables

I suggest you define your environment variables in your Project Settings. See [CircleCI documentation](https://circleci.com/docs/2.0/env-vars/#setting-an-environment-variable-in-a-project) on the many ways to define environment variables.

* The WPE Environment variables are required for deployments. These should match your WP Engine site environment names.
* The [Rollbar access token](https://docs.rollbar.com/reference#section-authentication) allows you to notify rollbar about the deploy process
* The Composer Auth variable allows you to install private GitHub repositories with your personal [GitHub token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/).
* WPE Environment variables are required for deployments. These should match your WP Engine site environment names.
* A [Rollbar access token](https://docs.rollbar.com/reference#section-authentication) allows you to notify rollbar about the deploy process
* A Composer Auth variable allows you to install private GitHub repositories with your personal [GitHub token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/).

```bash
WPE_PRODUCTION_ENVIRONMENT=mysite
Expand Down
32 changes: 19 additions & 13 deletions orb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,11 @@ jobs:
parameters:
environment:
description: |
Are we deploying to the production, staging, or development environment?
Each of these environments needs a corresponding environment variable defined
Are we deploying to the production, staging, development, or custom environment?
Production, staging, and development need a corresponding environment variable defined
in CircleCI's project configuration. An optional `./.gitignores/__deployment`
file can be used to deploy build files rather than source files.
type: enum
enum:
- production
- staging
- development
type: string
executor: base
steps:
- install:
Expand Down Expand Up @@ -216,12 +212,22 @@ jobs:
- run:
name: Set up the WPE install name
command: |
echo 'export WPE_INSTALL=$( \
case << parameters.environment >> in \
production) echo $WPE_PRODUCTION_INSTALL;; \
staging) echo $WPE_STAGING_INSTALL;; \
development) echo $WPE_DEVELOPMENT_INSTALL;; \
esac )' >> $BASH_ENV
echo 'export WPE_INSTALL=$(
case << parameters.environment >> in
production)
echo $WPE_PRODUCTION_INSTALL
;;
staging)
echo $WPE_STAGING_INSTALL
;;
development)
echo $WPE_DEVELOPMENT_INSTALL
;;
*)
echo << parameters.environment >>
;;
esac
)' >> $BASH_ENV
source $BASH_ENV
# Set up the git remotes for WP Engine
Expand Down

0 comments on commit 3a9d176

Please sign in to comment.