ssh-action/.github/workflows/ci.yml

121 lines
3.0 KiB
YAML
Raw Normal View History

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:
2020-02-13 13:20:15 +00:00
- name: checkout
uses: actions/checkout@v1
- name: executing remote ssh commands using password
2020-02-13 13:20:15 +00:00
uses: ./
2019-09-29 02:43:33 +00:00
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: whoami
- name: executing remote ssh commands using ssh key
2020-02-13 13:20:15 +00:00
uses: ./
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
2020-02-13 13:20:15 +00:00
uses: ./
2019-09-29 02:53:17 +00:00
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
2020-02-13 13:20:15 +00:00
# uses: ./
2019-09-29 04:02:21 +00:00
# with:
# host: ${{ secrets.HOST }}
# username: ${{ secrets.USERNAME }}
# key: ${{ secrets.KEY }}
# port: ${{ secrets.PORT }}
# script_stop: true
# script: |
# mkdir abc/def
# ls -al
2019-09-29 03:16:09 +00:00
- name: pass environment
2020-02-13 13:20:15 +00:00
uses: ./
2019-09-29 03:16:09 +00:00
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: |
echo "I am $FOO, thanks"
echo "I am $BAR, thanks"
2019-12-07 12:19:15 +00:00
- name: pass multiple environment
2020-02-13 13:20:15 +00:00
uses: ./
2019-12-07 12:19:15 +00:00
env:
FOO: "BAR"
BAR: "FOO"
SHA: ${{ github.sha }}
2019-12-07 12:19:15 +00:00
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
envs: FOO,BAR,SHA
2019-12-07 12:19:15 +00:00
script: |
echo "I am $FOO, thanks"
echo "I am $BAR, thanks"
2020-02-09 03:29:31 +00:00
echo "sha: $SHA"
- name: ssh key passphrase
2020-02-13 13:20:15 +00:00
uses: ./
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH2 }}
port: ${{ secrets.PORT }}
passphrase: ${{ secrets.PASSPHRASE }}
script: |
whoami
ls -al
- name: use insecure cipher
uses: ./
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: |
ls \
-lah
use_insecure_cipher: true
# 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