mirror of
https://gitea.com/actions/appleboy-ssh-action.git
synced 2024-11-29 13:39:36 +01:00
e5c07fceef
* support passphrase Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
89 lines
2.3 KiB
YAML
89 lines
2.3 KiB
YAML
name: remote ssh command
|
|
on: [push]
|
|
jobs:
|
|
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: executing remote ssh commands using password
|
|
uses: appleboy/ssh-action@master
|
|
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
|
|
|
|
- name: multiple command
|
|
uses: appleboy/ssh-action@master
|
|
with:
|
|
host: ${{ secrets.HOST }}
|
|
username: ${{ secrets.USERNAME }}
|
|
key: ${{ secrets.KEY }}
|
|
port: ${{ secrets.PORT }}
|
|
script: |
|
|
whoami
|
|
ls -al
|
|
|
|
# - 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
|
|
# 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 }}
|
|
envs: FOO
|
|
script: |
|
|
echo "I am $FOO, thanks"
|
|
echo "I am $BAR, thanks"
|
|
|
|
- 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"
|
|
|
|
- name: ssh key passphrase
|
|
uses: appleboy/ssh-action@master
|
|
with:
|
|
host: ${{ secrets.HOST }}
|
|
username: ${{ secrets.USERNAME }}
|
|
key: ${{ secrets.SSH2 }}
|
|
port: ${{ secrets.PORT }}
|
|
passphrase: ${{ secrets.PASSPHRASE }}
|
|
script: |
|
|
whoami
|
|
ls -al
|