GitHub Action
Server Shell
v3
Latest version
This action could connect your self-server and execute commands on it via SSH. This is useful when you want to execute commands on your own server from your workflow.
- This action requires your own server SSH
PRIVATE_KEY
,IP
,PORT
andUSERNAME
corresponding to the PRIVATE_KEY.
The SHELL parameter in with is the command that needs to be executed on your own server.
steps:
- uses: actions/checkout@v2
- run: npm install
shell: bash
- uses: tzzs/server-shell@v3
with:
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY}}
USERNAME: ${{secrets.USERNAME}}
IP: ${{secrets.IP}}
PORT: ${{secrets.PORT}}
SHELL: |
"echo action-test"
"ls"
Add the following parameters to secrets:
PRIVATE_KEY
, IP
,SHELL(optional default:22)
,USERNAME
The following parameters (some optional) need to be configured in workflow.
-
PRIVATE_KEY
[required]This is from the
~/.ssh/id_rsa
file. -
IP
[required]eg: 127.0.0.1
-
PORT
[optional, default: 22]eg: 22
-
USERNAME
[required]eg: root
-
SHELL
(optional), use the|
symbol to add multiple commandsSHELL: | "echo action-test" "ls"
The result of each command is printed in the action console.
Protect your private key and use at your own risk.