Skip to content

Instantly share code, notes, and snippets.

@CreatiCoding
Created September 30, 2022 08:33
Show Gist options
  • Select an option

  • Save CreatiCoding/8534dd6256e1698f590cfb23c710022d to your computer and use it in GitHub Desktop.

Select an option

Save CreatiCoding/8534dd6256e1698f590cfb23c710022d to your computer and use it in GitHub Desktop.
github-action for ssh commands
name: remote ssh command
on: [push]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Deploy
run: |
CMDS=$(cat <<CMD
# 실행하고 싶은 commands를 나열
whoami
pwd
echo 1
ps -ef
CMD
)
sshpass -p ${{ secrets.PASSWORD }} ssh -o 'StrictHostKeyChecking no' \
-p ${{ secrets.PORT }} ${{secrets.USERNAME}}@${{secrets.HOST}} \
-t "$CMDS"
@CreatiCoding

Copy link
Copy Markdown
Author

CMDS의 CMD deliemeter 의 위치(indent 기반)가 중요합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment