-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (32 loc) · 1.2 KB
/
deploy.yml
File metadata and controls
38 lines (32 loc) · 1.2 KB
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
name: Deploy Theme to Server
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan -p ${{ secrets.DEPLOY_PORT || '22' }} -H "${{ secrets.DEPLOY_HOST }}" >> ~/.ssh/known_hosts
- name: Stamp build version
run: |
BUILD_VERSION="1.0.${{ github.run_number }}"
sed -i "s/^Version: .*/Version: ${BUILD_VERSION}/" style.css
sed -i "s/define( 'SCOUT_STARTER_VERSION', '[^']*' );/define( 'SCOUT_STARTER_VERSION', '${BUILD_VERSION}' );/" functions.php
- name: Deploy via rsync
run: |
rsync -az --delete \
-e "ssh -i ~/.ssh/deploy_key -p ${{ secrets.DEPLOY_PORT || '22' }} -o StrictHostKeyChecking=no" \
--exclude='.git' \
--exclude='.github' \
--exclude='README.md' \
--exclude='CLAUDE.md' \
./ \
"${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:${{ secrets.DEPLOY_PATH }}/scout-starter/"