Skip to content

Instantly share code, notes, and snippets.

@BenBroide
Created March 23, 2022 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BenBroide/7d3bffbaae3910f1c1b52731f0b5ec05 to your computer and use it in GitHub Desktop.
Save BenBroide/7d3bffbaae3910f1c1b52731f0b5ec05 to your computer and use it in GitHub Desktop.
name: Deploy to WP Engine
on:
workflow_dispatch:
inputs:
environment:
description: "prd/dev/staging/. Default is dev"
required: false
default: ""
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 20
if: ${{ (github.event.inputs.environment == 'prd' && contains(fromJson('["admin1", "admin2", "admin3"]'), github.actor)) || contains(fromJson('["dev", "staging"]'), github.event.inputs.environment) || github.event.inputs.environment == '' }}
env:
ENVIRONMENT: ${{
((github.event.inputs.environment == 'dev' || github.event.inputs.environment == '') && 'wpenginedevenvname') ||
(github.event.inputs.environment == 'prd' && 'wpengineenvname') ||
(github.event.inputs.environment == 'staging' && 'wpenginestgenvname')
}}
steps:
- name: Checkout to repository
uses: actions/checkout@v2
with:
token: ${{ github.token }}
- name: Setup Nodejs
uses: actions/setup-node@v2
with:
node-version: 14
- name: Install dependencies admin app
run: npm ci
working-directory: "./admin-app"
- name: Build Project admin app
run: npm run build
working-directory: "./admin-app"
- name: Remove dependencies admin app
run: rm -rf node_modules
working-directory: "./admin-app"
- name: Remove .git folder
run: rm -rf .git
- name: GitHub Action Deploy to WP Engine
uses: wpengine/github-action-wpe-site-deploy@v2.3.3
with:
# Keys, lint & url options
FLAGS: -azvr --inplace --exclude=".*"
WPE_SSHG_KEY_PRIVATE: ${{ secrets.WPENGINE_SSH_KEY_PRIVATE }}
TPO_PATH: "wp-content/themes/theme-folder/"
# Branches & Environments
PRD_BRANCH: master
PRD_ENV: ${{ env.ENVIRONMENT }}
STG_BRANCH: ${{ github.ref }}
STG_ENV: ${{ env.ENVIRONMENT }}
DEV_BRANCH: ${{ github.ref }}
DEV_ENV: ${{ env.ENVIRONMENT }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment