LuisEnMarroquin / setup-ssh-action

GitHub Action that sets up your SSH key on the Virtual Environment
https://github.com/marketplace/actions/setup-ssh-action
MIT License
7 stars 5 forks source link
actions cd ci ci-cd github github-actions javascript js macos marketplace node node-js secrets ssh ssh-key ts typescript ubuntu windows workflow

Setup SSH - GitHub Action

Fail Fail Fail

This action sets up your SSH key on Windows, macOS and Ubuntu Virtual Environments

Example usage

Setup for GitHub

name: Deployment

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: LuisEnMarroquin/setup-ssh-action@v2.0.5
        with:
          SSHKEY: ${{ secrets.SSH }} # ----- BEGIN RSA PRIVATE KEY----- ...
      - run: ssh -T git@github.com || true

Setup for your server

name: Deployment

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: LuisEnMarroquin/setup-ssh-action@v2.0.5
        with:
          ORIGIN: ${{ secrets.HOST }} # example.com || 8.8.8.8
          SSHKEY: ${{ secrets.SSH }} # ----- BEGIN RSA PRIVATE KEY----- ...
          NAME: production
          PORT: ${{ secrets.PORT }} # 3000
          USER: ${{ secrets.USER }} # admin
      - run: ssh production ls --help

Inputs

Key Value Information Required
ORIGIN Where to log in, can be a Domain or IP address, defaults to github.com No
SSHKEY Your SSH access key, it's better to store it on your repository secrets Yes
NAME How you can refer to the SSH key in the next commands, defaults to ORIGIN No
PORT The port that will be on the SSH config No
USER The user that will be on the SSH config No

Your repo secrets are at: https://github.com/<username>/<repository>/settings/secrets

How to release new version

  1. Create deployable file
npm run build
  1. Create a tag and push it
git tag -a v2.0.5 -m "Changed all files version to the proper one"
git push origin v2.0.5
  1. Go to releases page and click Draft a new release

https://github.com/LuisEnMarroquin/setup-ssh-action/releases

  1. Fill with correct data
  1. Git add, commit and push your changes
gacp Changed all files version to the proper one
  1. Validate that pipelines worked