2019-09-29 10:45:29 +08:00
|
|
|
name: remote ssh command
|
2019-09-29 10:43:33 +08:00
|
|
|
on: [push]
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
build:
|
|
|
|
name: Build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2020-02-13 21:20:15 +08:00
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v1
|
|
|
|
|
2019-09-29 10:52:20 +08:00
|
|
|
- name: executing remote ssh commands using password
|
2020-02-13 21:20:15 +08:00
|
|
|
uses: ./
|
2019-09-29 10:43:33 +08:00
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
password: ${{ secrets.PASSWORD }}
|
|
|
|
port: ${{ secrets.PORT }}
|
|
|
|
script: whoami
|
2019-09-29 10:52:20 +08:00
|
|
|
|
|
|
|
- name: executing remote ssh commands using ssh key
|
2020-02-13 21:20:15 +08:00
|
|
|
uses: ./
|
2019-09-29 10:52:20 +08:00
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.KEY }}
|
|
|
|
port: ${{ secrets.PORT }}
|
|
|
|
script: whoami
|
2019-09-29 10:53:17 +08:00
|
|
|
|
|
|
|
- name: multiple command
|
2020-02-13 21:20:15 +08:00
|
|
|
uses: ./
|
2019-09-29 10:53:17 +08:00
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.KEY }}
|
|
|
|
port: ${{ secrets.PORT }}
|
2019-09-29 10:55:53 +08:00
|
|
|
script: |
|
2019-09-29 10:53:17 +08:00
|
|
|
whoami
|
|
|
|
ls -al
|
2019-09-29 11:16:09 +08:00
|
|
|
|
2019-09-29 12:02:21 +08:00
|
|
|
# - name: stop script if command error
|
2020-02-13 21:20:15 +08:00
|
|
|
# uses: ./
|
2019-09-29 12:02:21 +08:00
|
|
|
# with:
|
|
|
|
# host: ${{ secrets.HOST }}
|
|
|
|
# username: ${{ secrets.USERNAME }}
|
|
|
|
# key: ${{ secrets.KEY }}
|
|
|
|
# port: ${{ secrets.PORT }}
|
|
|
|
# script_stop: true
|
2019-11-20 23:49:31 +08:00
|
|
|
# script: |
|
|
|
|
# mkdir abc/def
|
|
|
|
# ls -al
|
2019-09-29 11:16:09 +08:00
|
|
|
|
|
|
|
- name: pass environment
|
2020-02-13 21:20:15 +08:00
|
|
|
uses: ./
|
2019-09-29 11:16:09 +08:00
|
|
|
env:
|
|
|
|
FOO: "BAR"
|
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.KEY }}
|
|
|
|
port: ${{ secrets.PORT }}
|
2019-09-29 11:19:40 +08:00
|
|
|
envs: FOO
|
2019-09-29 11:16:09 +08:00
|
|
|
script: |
|
2019-11-20 23:49:31 +08:00
|
|
|
echo "I am $FOO, thanks"
|
|
|
|
echo "I am $BAR, thanks"
|
2019-12-07 20:19:15 +08:00
|
|
|
|
|
|
|
- name: pass multiple environment
|
2020-02-13 21:20:15 +08:00
|
|
|
uses: ./
|
2019-12-07 20:19:15 +08:00
|
|
|
env:
|
|
|
|
FOO: "BAR"
|
|
|
|
BAR: "FOO"
|
2020-02-09 11:25:59 +08:00
|
|
|
SHA: ${{ github.sha }}
|
2019-12-07 20:19:15 +08:00
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.KEY }}
|
|
|
|
port: ${{ secrets.PORT }}
|
2020-02-09 11:25:59 +08:00
|
|
|
envs: FOO,BAR,SHA
|
2019-12-07 20:19:15 +08:00
|
|
|
script: |
|
|
|
|
echo "I am $FOO, thanks"
|
|
|
|
echo "I am $BAR, thanks"
|
2020-02-09 11:29:31 +08:00
|
|
|
echo "sha: $SHA"
|
2019-12-30 19:50:55 +08:00
|
|
|
|
|
|
|
- name: ssh key passphrase
|
2020-02-13 21:20:15 +08:00
|
|
|
uses: ./
|
2019-12-30 19:50:55 +08:00
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.SSH2 }}
|
|
|
|
port: ${{ secrets.PORT }}
|
|
|
|
passphrase: ${{ secrets.PASSPHRASE }}
|
|
|
|
script: |
|
|
|
|
whoami
|
|
|
|
ls -al
|