Skip to content
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Latest commit

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Long Ao Dai - SSH Command Executor Action

This GitHub Action allows you to execute SSH commands on a remote server.

Usage

Case 1: SSH by Password

To use this action in your workflow, you can add it as a step in your YAML file like this:

Path file: .github/workflows/deploy.yml

name: SSH Pull Codeon:
push:
branches:
- mainjobs:
deploy:
runs-on: ubuntu-lateststeps:
- name: SSH Serveruses: longaodai/ssh-server@v2.0.0with:
host: ${{ secrets.HOST }}username: ${{ secrets.USERNAME }}password: ${{ secrets.PASSWORD }}commands: 'cd app && git pull origin'

Case 2: SSH by Private Key

To use this action in your workflow, you can add it as a step in your YAML file like this:

You can follow setup in post of HionCoding: HionCoding Auto Deploy Project

Path file: .github/workflows/deploy.yml

name: SSH Pull Codeon:
push:
branches:
- mainjobs:
deploy:
runs-on: ubuntu-lateststeps:
- name: SSH Serveruses: longaodai/ssh-server@v2.0.0with:
host: ${{ secrets.HOST }}username: ${{ secrets.USERNAME }}ssh-private-key: ${{ secrets.SSHKEY }}commands: 'cd app && git pull origin'

In this example, the action will execute the commands provided in the commands input on the remote server specified by the host, username, and (password or ssh-private-key) inputs.

Inputs

host: (Required) The hostname or IP address of the remote server.

username: (Required) The username used for SSH authentication.

password: (Required if you want to connect by password) The password used for SSH authentication.

ssh-private-key: (Required if you want to connect by private key) The private key used for SSH authentication.

commands: (Required) The commands to be executed on the remote server. You can provide multiple commands separated by a && character.

Secrets

Make sure to add the following secrets to your repository:

HOST: The hostname or IP address of the remote server.

USERNAME: The username used for SSH authentication.

PASSWORD: The password used for SSH authentication. (Required if you want to connect by password)

SSHKEY: The private key used for SSH authentication. (Required if you want to connect by private key)

Contributing

We would love for you to contribute to longaodai/ssh-server, pull requests are welcome !

License

The scripts and documentation in this project are released under the MIT License

About

Package Github Action for auto deploy ~.~'

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages