-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (41 loc) · 1.42 KB
/
deploy.yml
File metadata and controls
48 lines (41 loc) · 1.42 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
39
40
41
42
43
44
45
46
47
48
name: Deploy Website
on:
push:
branches: ["main"]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare incoming dir
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
port: ${{ secrets.DEPLOY_PORT }}
script: |
set -e
mkdir -p "${{ secrets.DEPLOY_PATH }}/.incoming"
- name: Rsync upload to incoming
uses: burnett01/rsync-deployments@7.0.1
with:
switches: -avzr --delete --exclude='.git/' --exclude='.github/' --exclude='.incoming/'
path: ./
remote_path: ${{ secrets.DEPLOY_PATH }}/.incoming/
remote_host: ${{ secrets.DEPLOY_HOST }}
remote_user: ${{ secrets.DEPLOY_USER }}
remote_key: ${{ secrets.DEPLOY_KEY }}
remote_port: ${{ secrets.DEPLOY_PORT }}
- name: Swap into live
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
port: ${{ secrets.DEPLOY_PORT }}
script: |
set -e
TARGET="${{ secrets.DEPLOY_PATH }}"
rsync -a --delete --exclude='.incoming/' "$TARGET/.incoming/" "$TARGET/"
rm -rf "$TARGET/.incoming"