-
Notifications
You must be signed in to change notification settings - Fork 15
127 lines (126 loc) · 4.18 KB
/
main.yml
File metadata and controls
127 lines (126 loc) · 4.18 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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
on:
push:
branches:
- master
paths:
- .github/workflows/main.yml
- action.yml
- Dockerfile
- entrypoint.sh
jobs:
test:
runs-on: ubuntu-latest
name: Testing and build
steps:
- uses: actions/checkout@v4
- uses: up9cloud/action-rsync@master
name: |
Mode: push, local (SOURCE) to remote (TARGET), run scripts on remote (TARGET)
env:
HOST: ${{secrets.DEPLOY_HOST}}
KEY: ${{secrets.DEPLOY_SSH_KEY}}
TARGET: /tmp/action-rsync_push/
VERBOSE: true
PRE_SCRIPT: |
echo I ❤️ this action!
rm -fr /tmp/action-rsync_push
date -u
POST_SCRIPT: "ls /tmp/action-rsync_push && date -u"
- uses: up9cloud/action-rsync@master
name: |
Test multiple hosts
env:
REMOTE_HOSTS: ${{secrets.DEPLOY_HOST}},${{secrets.DEPLOY_HOST}}
KEY: ${{secrets.DEPLOY_SSH_KEY}}
TARGET: /tmp/action-rsync_push/
VERBOSE: true
PRE_SCRIPT: |
echo I ❤️ this action!
rm -fr /tmp/action-rsync_push
date -u
POST_SCRIPT: "ls /tmp/action-rsync_push && date -u"
- uses: up9cloud/action-rsync@master
name: |
Mode: push, local (SOURCE) to remote (TARGET), ssh login by PASSWORD
env:
HOST: ${{secrets.DEPLOY_HOST}}
USER: ${{secrets.DEPLOY_SSH_USER}}
PASSWORD: ${{secrets.DEPLOY_SSH_PASSWORD}}
TARGET: /tmp/action-rsync_push_via_ssh_password/
VERBOSE: true
PRE_SCRIPT: |
date -u
POST_SCRIPT: "pwd && date -u"
- uses: up9cloud/action-rsync@master
name: |
Mode: push, local (SOURCE) to remote (TARGET), run scripts at local (SOURCE)
env:
HOST: ${{secrets.DEPLOY_HOST}}
KEY: ${{secrets.DEPLOY_SSH_KEY}}
TARGET: /tmp/action-rsync/
VERBOSE: true
RUN_SCRIPT_ON: local
PRE_SCRIPT: |
ls
date -u
POST_SCRIPT: "ls && date -u"
- uses: up9cloud/action-rsync@master
name: |
Mode: pull, remote (SOURCE) to local (TARGET), run scripts at local (TARGET)
env:
MODE: pull
HOST: ${{secrets.DEPLOY_HOST}}
KEY: ${{secrets.DEPLOY_SSH_KEY}}
SOURCE: /root/.profile
TARGET: /tmp/.profile
VERBOSE: true
PRE_SCRIPT: |
if ls /tmp/.profile; then
exit 2
fi
date -u
POST_SCRIPT: "cat /tmp/.profile && date -u"
- uses: up9cloud/action-rsync@master
name: |
Mode: pull, remote (SOURCE) to local (TARGET), run scripts on remote (SOURCE)
env:
MODE: pull
HOST: ${{secrets.DEPLOY_HOST}}
KEY: ${{secrets.DEPLOY_SSH_KEY}}
SOURCE: /root/.profile
TARGET: /tmp/.profile
VERBOSE: true
RUN_SCRIPT_ON: source
PRE_SCRIPT: date -u
POST_SCRIPT: date -u
- uses: up9cloud/action-rsync@master
name: |
Mode: local, local (SOURCE) to local (TARGET), run scripts at local (always)
env:
MODE: local
TARGET: /tmp/action-rsync_local/
VERBOSE: true
PRE_SCRIPT: |
if ls /tmp/action-rsync_local; then
exit 2
fi
date -u
POST_SCRIPT: "ls /tmp/action-rsync_local && date -u"
- uses: docker/login-action@v3
if: ${{ github.event_name == 'push' && success() }}
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/setup-buildx-action@v3
if: ${{ github.event_name == 'push' && success() }}
- uses: docker/build-push-action@v6
if: ${{ github.event_name == 'push' && success() }}
with:
push: true
tags: sstc/action-rsync:latest
- uses: up9cloud/action-notify@master
if: cancelled() == false
env:
GITHUB_JOB_STATUS: ${{ job.status }}
TELEGRAM_BOT_TOKEN: ${{secrets.TELEGRAM_BOT_TOKEN}}
TELEGRAM_CHAT_ID: ${{secrets.TELEGRAM_CHAT_ID}}