-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (62 loc) · 1.89 KB
/
regular-server.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
name: Deploy Main to Regular Server
on:
push:
branches:
- live
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache Env
uses: actions/cache@v4
id: cache-env-staging
with:
path: |
.env
key: cacheKey-staging-${{ github.run_id }}-${{ github.run_attempt }}
- name: Prepare env variables
uses: danielr1996/[email protected]
with:
input: .env.example
output: .env
env:
APP_NAME: 'awwa'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20' # Use the Node.js version required for your theme
- name: Install dependencies
run: |
npm install
- name: Build CSS assets
run: |
npm run build
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
- name: Install PHP dependencies
run: |
composer install
- name: Build CSS assets
run: |
npm run build
- name: Zip theme files
run: |
zip -r theme-package.zip .
- name: Set up SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_LIVE_KEY }}
- name: Upload theme package via SCP
run: |
scp -P ${{ secrets.SSH_LIVE_PORT }} -o StrictHostKeyChecking=no theme-package.zip ${{ secrets.SSH_LIVE_USER }}@${{ secrets.SSH_LIVE_HOST }}:/export/path
- name: Deploy theme on server
run: |
ssh -p ${{ secrets.SSH_LIVE_PORT }} -o StrictHostKeyChecking=no ${{ secrets.SSH_LIVE_USER }}@${{ secrets.SSH_LIVE_HOST }} << 'EOF'
export PACKAGE_ZIP=/export/path/theme-package.zip
unzip -o "$PACKAGE_ZIP" -d /www/wordpress/theme/path
[ -f "$PACKAGE_ZIP" ] && rm "$PACKAGE_ZIP"
EOF