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:
|
2020-02-13 14:20:15 +01:00
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v1
|
|
|
|
|
2019-09-29 04:52:20 +02:00
|
|
|
- name: executing remote ssh commands using password
|
2020-02-13 14:20:15 +01:00
|
|
|
uses: ./
|
2019-09-29 04:43:33 +02:00
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
password: ${{ secrets.PASSWORD }}
|
|
|
|
port: ${{ secrets.PORT }}
|
|
|
|
script: whoami
|
2019-09-29 04:52:20 +02:00
|
|
|
|
|
|
|
- name: executing remote ssh commands using ssh key
|
2020-02-13 14:20:15 +01:00
|
|
|
uses: ./
|
2019-09-29 04:52:20 +02:00
|
|
|
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
|
2020-02-13 14:20:15 +01:00
|
|
|
uses: ./
|
2019-09-29 04:53:17 +02:00
|
|
|
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
|
|
|
|
2019-09-29 06:02:21 +02:00
|
|
|
# - name: stop script if command error
|
2020-02-13 14:20:15 +01:00
|
|
|
# uses: ./
|
2019-09-29 06:02:21 +02:00
|
|
|
# with:
|
|
|
|
# host: ${{ secrets.HOST }}
|
|
|
|
# username: ${{ secrets.USERNAME }}
|
|
|
|
# key: ${{ secrets.KEY }}
|
|
|
|
# port: ${{ secrets.PORT }}
|
|
|
|
# script_stop: true
|
2019-11-20 16:49:31 +01:00
|
|
|
# script: |
|
|
|
|
# mkdir abc/def
|
|
|
|
# ls -al
|
2019-09-29 05:16:09 +02:00
|
|
|
|
|
|
|
- name: pass environment
|
2020-02-13 14:20:15 +01:00
|
|
|
uses: ./
|
2019-09-29 05:16:09 +02:00
|
|
|
env:
|
|
|
|
FOO: "BAR"
|
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.KEY }}
|
|
|
|
port: ${{ secrets.PORT }}
|
2019-09-29 05:19:40 +02:00
|
|
|
envs: FOO
|
2019-09-29 05:16:09 +02:00
|
|
|
script: |
|
2019-11-20 16:49:31 +01:00
|
|
|
echo "I am $FOO, thanks"
|
|
|
|
echo "I am $BAR, thanks"
|
2019-12-07 13:19:15 +01:00
|
|
|
|
|
|
|
- name: pass multiple environment
|
2020-02-13 14:20:15 +01:00
|
|
|
uses: ./
|
2019-12-07 13:19:15 +01:00
|
|
|
env:
|
|
|
|
FOO: "BAR"
|
|
|
|
BAR: "FOO"
|
2020-02-09 04:25:59 +01:00
|
|
|
SHA: ${{ github.sha }}
|
2019-12-07 13:19:15 +01:00
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.KEY }}
|
|
|
|
port: ${{ secrets.PORT }}
|
2020-02-09 04:25:59 +01:00
|
|
|
envs: FOO,BAR,SHA
|
2019-12-07 13:19:15 +01:00
|
|
|
script: |
|
|
|
|
echo "I am $FOO, thanks"
|
|
|
|
echo "I am $BAR, thanks"
|
2020-02-09 04:29:31 +01:00
|
|
|
echo "sha: $SHA"
|
2019-12-30 12:50:55 +01:00
|
|
|
|
|
|
|
- name: ssh key passphrase
|
2020-02-13 14:20:15 +01:00
|
|
|
uses: ./
|
2019-12-30 12:50:55 +01:00
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
key: ${{ secrets.SSH2 }}
|
|
|
|
port: ${{ secrets.PORT }}
|
|
|
|
passphrase: ${{ secrets.PASSPHRASE }}
|
|
|
|
script: |
|
|
|
|
whoami
|
|
|
|
ls -al
|
2020-05-24 04:54:31 +02:00
|
|
|
|
|
|
|
- name: use insecure cipher
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
password: ${{ secrets.PASSWORD }}
|
|
|
|
port: ${{ secrets.PORT }}
|
2020-08-03 16:15:09 +02:00
|
|
|
script: |
|
|
|
|
ls \
|
|
|
|
-lah
|
2020-05-24 04:54:31 +02:00
|
|
|
use_insecure_cipher: true
|
2020-08-08 06:26:01 +02:00
|
|
|
|
|
|
|
# https://github.com/appleboy/ssh-action/issues/75#issuecomment-668314271
|
|
|
|
- name: Multiline SSH commands interpreted as single lines
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
password: ${{ secrets.PASSWORD }}
|
|
|
|
port: ${{ secrets.PORT }}
|
|
|
|
script_stop: true
|
|
|
|
script: |
|
|
|
|
ls \
|
|
|
|
-lah
|
|
|
|
use_insecure_cipher: true
|
2020-11-17 03:20:18 +01:00
|
|
|
|
|
|
|
# https://github.com/appleboy/ssh-action/issues/85
|
|
|
|
- name: Deployment to multiple hosts with different ports
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
host: "${{ secrets.HOST }}:${{ secrets.PORT }}"
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
password: ${{ secrets.PASSWORD }}
|
|
|
|
port: 1024
|
|
|
|
script_stop: true
|
|
|
|
script: |
|
|
|
|
ls \
|
|
|
|
-lah
|
|
|
|
use_insecure_cipher: true
|