Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nekiro/ssh-job
Github Action for ssh programmatic use
https://github.com/nekiro/ssh-job
action client github githubaction ssh ssh-client
Last synced: 3 months ago
JSON representation
Github Action for ssh programmatic use
- Host: GitHub
- URL: https://github.com/nekiro/ssh-job
- Owner: nekiro
- License: mit
- Created: 2023-07-18T16:57:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-03T20:51:39.000Z (7 months ago)
- Last Synced: 2024-11-14T12:02:51.946Z (3 months ago)
- Topics: action, client, github, githubaction, ssh, ssh-client
- Language: TypeScript
- Homepage: https://github.com/marketplace/actions/ssh-job
- Size: 1.51 MB
- Stars: 10
- Watchers: 1
- Forks: 3
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
[![test-build](https://github.com/nekiro/ssh-job/actions/workflows/test-build.yml/badge.svg)](https://github.com/nekiro/ssh-job/actions/workflows/test-build.yml)
# ssh-job
Easier automated deployment through ssh via Github Action. 🚀
Execute commands on target server with few easy steps :)
## Options
| Param | default | required | description |
| :------------------ | :-----: | :------: | ------------------------------------------------------------------------------------------------------------ |
| host | n/a | true | Host to connect to |
| port | 22 | false | Port to connect to |
| key | n/a | true | Private key used for authorization |
| passphrase | n/a | false | Passphrase used to decrypt key |
| user | n/a | true | User used for authorization |
| password | n/a | false | Password used for authorization |
| envs | n/a | false | Json serialized secrets exported to shell |
| ignoredEnvs | n/a | false | List of comma separated envs to ignore when exporting to shell |
| command | n/a | true | Command/s or script to execute |
| exportActionOptions | false | true | Export action options, this is handy when you want to access HOST, USER or any other options in shell script |## Examples
Authorize with ssh private key and execute some commands
```yml
- name: create-directory
uses: nekiro/ssh-job@main
with:
host: ${{ secrets.HOST }}
key: ${{ secrets.KEY }}
user: ${{ secrets.USER }}
command: |
ls
mkdir dir
```It's possible to automatically pass github secrets to the shell script, it allows you to use provided secrets directly in the bash script.
In this example, we have few secrets for example `DIRECTORY`, we want to pass all of them to shell script, so we simply add `envs: ${{ toJson(secrets) }}` and use it as regular bash variable
Keep in mind action options are not exported by default, so you wont be able to access HOST, KEY etc.
```yml
- name: create-directory
uses: nekiro/ssh-job@main
with:
host: ${{ secrets.HOST }}
key: ${{ secrets.KEY }}
user: ${{ secrets.USER }}
envs: ${{ toJson(secrets) }}
command: mkdir $DIRECTORY
```## Contribution
Want to improve this project or found a bug? Feel free to open pull requests and create issues.
If you are not technical or simply don't have time, there is always a way to give back by clicking on the sponsor tab and sending some $, everything is appreciated :D