Execute Command on Remote Server #44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Execute Command on Remote Server | |
# 定时任务触发,使用 schedule 事件 | |
on: | |
schedule: | |
- cron: '0 17 * * *' | |
jobs: | |
remote-command: | |
runs-on: ubuntu-latest | |
steps: | |
# 检出代码 | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# 使用 SSH 执行远程命令 | |
- name: Execute command on remote server | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
script: | |
bash ~/live/stop.sh && bash ~/live/start.sh |