-
Notifications
You must be signed in to change notification settings - Fork 361
45 lines (37 loc) · 1.07 KB
/
sync.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
name: sync
on:
schedule:
- cron: '30 20 * * 1-5'
jobs:
sync:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.20"
- name: Build
run: CGO_ENABLED=0 go build -o app
- name: Dump JSON Files
run: ./app json -d
- name: Tar JSON Files
run: tar czvf jsons.tar.gz ./*.json
- name: Scp JSON Files
uses: appleboy/scp-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
port: ${{ secrets.REMOTE_PORT }}
key: ${{ secrets.SERVER_SSH_KEY }}
source: 'jsons.tar.gz'
target: ${{ secrets.REMOTE_TARGET }}
- name: SSH Remote Commands
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
port: ${{ secrets.REMOTE_PORT }}
key: ${{ secrets.SERVER_SSH_KEY }}
script: cd ${{ secrets.REMOTE_TARGET }} && tar xzvf jsons.tar.gz