2019-09-29 02:45:29 +00:00
|
|
|
name: remote ssh command
|
2019-09-29 02:43:33 +00:00
|
|
|
on: [push]
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
build:
|
|
|
|
name: Build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2019-09-29 02:52:20 +00:00
|
|
|
- name: executing remote ssh commands using password
|
2019-09-29 02:46:23 +00:00
|
|
|
uses: appleboy/ssh-action@master
|
2019-09-29 02:43:33 +00:00
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
password: ${{ secrets.PASSWORD }}
|
|
|
|
port: ${{ secrets.PORT }}
|
|
|
|
script: whoami
|
2019-09-29 02:52:20 +00:00
|
|
|
|
|
|
|
- name: executing remote ssh commands using ssh key
|
|
|
|
uses: appleboy/ssh-action@master
|
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.KEY }}
|
|
|
|
port: ${{ secrets.PORT }}
|
|
|
|
script: whoami
|
2019-09-29 02:53:17 +00:00
|
|
|
|
|
|
|
- name: multiple command
|
|
|
|
uses: appleboy/ssh-action@master
|
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.KEY }}
|
|
|
|
port: ${{ secrets.PORT }}
|
2019-09-29 02:55:53 +00:00
|
|
|
script: |
|
2019-09-29 02:53:17 +00:00
|
|
|
whoami
|
|
|
|
ls -al
|
2019-09-29 03:16:09 +00:00
|
|
|
|
2019-09-29 04:02:21 +00:00
|
|
|
# - name: stop script if command error
|
|
|
|
# uses: appleboy/ssh-action@master
|
|
|
|
# with:
|
|
|
|
# host: ${{ secrets.HOST }}
|
|
|
|
# username: ${{ secrets.USERNAME }}
|
|
|
|
# key: ${{ secrets.KEY }}
|
|
|
|
# port: ${{ secrets.PORT }}
|
|
|
|
# script_stop: true
|
2019-11-20 15:49:31 +00:00
|
|
|
# script: |
|
|
|
|
# mkdir abc/def
|
|
|
|
# ls -al
|
2019-09-29 03:16:09 +00:00
|
|
|
|
|
|
|
- name: pass environment
|
|
|
|
uses: appleboy/ssh-action@master
|
|
|
|
env:
|
|
|
|
FOO: "BAR"
|
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.KEY }}
|
|
|
|
port: ${{ secrets.PORT }}
|
2019-09-29 03:19:40 +00:00
|
|
|
envs: FOO
|
2019-09-29 03:16:09 +00:00
|
|
|
script: |
|
2019-11-20 15:49:31 +00:00
|
|
|
echo "I am $FOO, thanks"
|
|
|
|
echo "I am $BAR, thanks"
|
2019-12-07 12:19:15 +00:00
|
|
|
|
|
|
|
- name: pass multiple environment
|
|
|
|
uses: appleboy/ssh-action@master
|
|
|
|
env:
|
|
|
|
FOO: "BAR"
|
|
|
|
BAR: "FOO"
|
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.KEY }}
|
|
|
|
port: ${{ secrets.PORT }}
|
|
|
|
envs: FOO,BAR
|
|
|
|
script: |
|
|
|
|
echo "I am $FOO, thanks"
|
|
|
|
echo "I am $BAR, thanks"
|