Created
September 30, 2022 08:33
-
-
Save CreatiCoding/8534dd6256e1698f590cfb23c710022d to your computer and use it in GitHub Desktop.
github-action for ssh commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CMDS의 CMD deliemeter 의 위치(indent 기반)가 중요합니다.