-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-to-kinsta
80 lines (64 loc) · 2.03 KB
/
deploy-to-kinsta
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
name: Deploy WordPress Theme to Kinsta
on:
push:
branches: [main, staging, dev]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Composer Packages
uses: php-actions/composer@v6
with:
php_version: 7.4.29
- name: Setup Node.js 14.x
uses: actions/setup-node@v3
with:
node-version: 14.x
cache: "yarn"
- name: Install dependencies
run: yarn
- name: Build files
run: yarn build
- name: Install zip
uses: montudor/action-zip@v1
- name: Zip output
run: zip -qq -r theme.zip * -x ".*" "node_modules/*" "*.md*" "*.log*" "*.json*" "*.lock*" "DOCKER_ENV" "docker_tag"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: theme
path: theme.zip
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: theme
- uses: montudor/action-zip@v1
with:
args: unzip -qq -o theme.zip -d .
- name: Remove theme.zip
run: rm theme.zip
- name: Deploy to staging
if: github.ref == 'refs/heads/staging'
uses: easingthemes/ssh-deploy@v4.1.8
env:
SSH_PRIVATE_KEY: ${{ secrets.STAGING_PRIVATE_KEY }}
REMOTE_HOST: ${{ secrets.SERVER }}
REMOTE_USER: ${{ secrets.USERNAME }}
REMOTE_PORT: ${{ secrets.STAGING_PORT }}
TARGET: ${{ secrets.STAGING_DIR }}
ARGS: "-rlgoDzvc -i --delete"
- name: Deploy to production
if: github.ref == 'refs/heads/main'
uses: easingthemes/ssh-deploy@v4.1.8
env:
SSH_PRIVATE_KEY: ${{ secrets.PROD_PRIVATE_KEY }}
REMOTE_HOST: ${{ secrets.SERVER }}
REMOTE_USER: ${{ secrets.USERNAME }}
REMOTE_PORT: ${{ secrets.PRODUCTION_PORT }}
TARGET: ${{ secrets.PRODUCTION_DIR }}
ARGS: "-rlgoDzvc -i --delete"