ssh/.github/workflows/ci.yml

62 lines
1.5 KiB
YAML
Raw Normal View History

2019-09-29 04:45:29 +02:00
name: remote ssh command
2019-09-29 04:43:33 +02:00
on: [push]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands using password
2019-09-29 04:46:23 +02:00
uses: appleboy/ssh-action@master
2019-09-29 04:43:33 +02:00
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: whoami
- 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 04:53:17 +02: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 04:55:53 +02:00
script: |
2019-09-29 04:53:17 +02:00
whoami
ls -al
2019-09-29 05:16:09 +02: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 }}
2019-09-29 05:17:11 +02:00
script_stop: true
2019-09-29 05:16:09 +02:00
script: |
mkdir abc/def
ls -al
- name: pass environment
uses: appleboy/ssh-action@master
env:
FOO: "BAR"
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: |
echo "I am $FOO"
echo "I am $BAR"