-
Notifications
You must be signed in to change notification settings - Fork 0
152 lines (130 loc) · 4.19 KB
/
deploy-wpe-production.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Deploy to Production
on:
workflow_dispatch:
inputs:
deploy_muplugins:
type: boolean
description: MU-Plugins
default: true
deploy_plugins:
type: boolean
description: Plugins
deploy_root:
type: boolean
description: Root files
deploy_themes:
type: boolean
description: Themes
default: true
env:
INSTALL:
SSH_HOST:
jobs:
deploy-root:
runs-on: ubuntu-latest
if: ${{ inputs.deploy_root }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Install SSH key
uses: benoitchantre/[email protected]
with:
private-key: ${{ secrets.WPENGINE_SSH_KEY_PRIVATE }}
private-key-name: deploy-wpengine
known-hosts: ${{ secrets.KNOWN_HOSTS }}
- name: Deploy root
run: |
rsync -chavP --stats \
-e 'ssh -i ~/.ssh/deploy-wpengine' \
--exclude /.git/ \
--exclude /.github/ \
--exclude /.gitignore \
--exclude /.ssh/ \
--exclude /.editorconfig \
--exclude /wp-config-sample.php \
--exclude /wp-content/ \
--filter=':- /.gitignore' \
./ "$INSTALL@$SSH_HOST:/sites/$INSTALL/"
deploy-plugins:
runs-on: ubuntu-latest
if: ${{ inputs.deploy_plugins }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Install SSH key
uses: benoitchantre/[email protected]
with:
private-key: ${{ secrets.WPENGINE_SSH_KEY_PRIVATE }}
private-key-name: deploy-wpengine
known-hosts: ${{ secrets.KNOWN_HOSTS }}
- name: Deploy plugins
run: |
rsync -chavP --delete --stats \
-e 'ssh -i ~/.ssh/deploy-wpengine' \
--exclude /.git/ \
--exclude /.github/ \
--exclude /.gitignore \
--exclude /.ssh/ \
--filter=':- /.gitignore' \
wp-content/plugins/ "$INSTALL@$SSH_HOST:/sites/$INSTALL/wp-content/plugins"
deploy-muplugins:
runs-on: ubuntu-latest
if: ${{ inputs.deploy_muplugins }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Install SSH key
uses: benoitchantre/[email protected]
with:
private-key: ${{ secrets.WPENGINE_SSH_KEY_PRIVATE }}
private-key-name: deploy-wpengine
known-hosts: ${{ secrets.KNOWN_HOSTS }}
- name: Deploy mu-plugins
run: |
rsync -chavP --stats \
-e 'ssh -i ~/.ssh/deploy-wpengine' \
--exclude /.git/ \
--exclude /.github/ \
--exclude /.gitignore \
--exclude /.ssh/ \
--filter=':- /.gitignore' \
wp-content/mu-plugins/ "$INSTALL@$SSH_HOST:/sites/$INSTALL/wp-content/mu-plugins"
deploy-themes:
runs-on: ubuntu-latest
if: ${{ inputs.deploy_themes }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Install SSH key
uses: benoitchantre/[email protected]
with:
private-key: ${{ secrets.WPENGINE_SSH_KEY_PRIVATE }}
private-key-name: deploy-wpengine
known-hosts: ${{ secrets.KNOWN_HOSTS }}
- name: Deploy themes
run: |
rsync -chavP --delete --stats \
-e 'ssh -i ~/.ssh/deploy-wpengine' \
--exclude /.git/ \
--exclude /.github/ \
--exclude /.gitignore \
--exclude /.ssh/ \
--filter=':- /.gitignore' \
wp-content/themes/ "$INSTALL@$SSH_HOST:/sites/$INSTALL/wp-content/themes"
clear-caches:
runs-on: ubuntu-latest
needs: [ deploy-plugins, deploy-muplugins, deploy-themes, deploy-root ]
if: ${{ always() && contains( needs.*.result, 'success' ) }}
steps:
- name: Install SSH key
uses: benoitchantre/[email protected]
with:
private-key: ${{ secrets.WPENGINE_SSH_KEY_PRIVATE }}
private-key-name: deploy-wpengine
known-hosts: ${{ secrets.KNOWN_HOSTS }}
- name: Clear caches
run: ssh -i ~/.ssh/deploy-wpengine $INSTALL@$SSH_HOST 'wp cache flush; wp page-cache flush; wp cdn-cache flush'