Skip to content

Commit e4ccfb8

Browse files
authored
Merge pull request #1 from SentioProberDev/cynthia-python_api_document_auto_update
Update .github/workflows/deploy.yml for Automatic Deployment Trigger
2 parents 40d1eb5 + e7bbbca commit e4ccfb8

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Deploy Website
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Prepare incoming dir
14+
uses: appleboy/ssh-action@v1.0.3
15+
with:
16+
host: ${{ secrets.DEPLOY_HOST }}
17+
username: ${{ secrets.DEPLOY_USER }}
18+
key: ${{ secrets.DEPLOY_KEY }}
19+
port: ${{ secrets.DEPLOY_PORT }}
20+
script: |
21+
set -e
22+
mkdir -p "${{ secrets.DEPLOY_PATH }}/.incoming"
23+
24+
- name: Rsync upload to incoming
25+
uses: burnett01/rsync-deployments@7.0.1
26+
with:
27+
switches: -avzr --delete
28+
path: ./
29+
remote_path: ${{ secrets.DEPLOY_PATH }}/.incoming/
30+
remote_host: ${{ secrets.DEPLOY_HOST }}
31+
remote_user: ${{ secrets.DEPLOY_USER }}
32+
remote_key: ${{ secrets.DEPLOY_KEY }}
33+
remote_port: ${{ secrets.DEPLOY_PORT }}
34+
35+
- name: Swap into live
36+
uses: appleboy/ssh-action@v1.0.3
37+
with:
38+
host: ${{ secrets.DEPLOY_HOST }}
39+
username: ${{ secrets.DEPLOY_USER }}
40+
key: ${{ secrets.DEPLOY_KEY }}
41+
port: ${{ secrets.DEPLOY_PORT }}
42+
script: |
43+
set -e
44+
TARGET="${{ secrets.DEPLOY_PATH }}"
45+
46+
rsync -a --delete "$TARGET/.incoming/" "$TARGET/"
47+
48+
rm -rf "$TARGET/.incoming"

0 commit comments

Comments
 (0)