From 3a9d176fd735f67d13b47fb2a762119b1daa25f2 Mon Sep 17 00:00:00 2001 From: Ryan Hoover Date: Mon, 29 Jul 2019 16:48:58 -0500 Subject: [PATCH] Add support for deploying to a feature install --- .circleci/config.yml | 13 ++++++++- README.md | 69 ++++---------------------------------------- orb.yml | 32 +++++++++++--------- 3 files changed, 36 insertions(+), 78 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8b5c135..4fca6d1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 @@ -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: diff --git a/README.md b/README.md index 9aec955..ff96a8d 100644 --- a/README.md +++ b/README.md @@ -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/wpengine@0.2.4 - -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 diff --git a/orb.yml b/orb.yml index 39f5a2e..3651f00 100644 --- a/orb.yml +++ b/orb.yml @@ -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: @@ -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