Custom App deploy to server with Github Action Workflow

Hello,

I created a custom app for ERPNext application. I created a github repository for the custom app. Now I want to deploy my custom changes to server from repository.

I can pull the updates from server. Now I want to add workflow from github.

I am new in Github CI/CD actions. I created workflow and yaml file to deploy server. But It shows error. Here is my yaml code:

name: Deploy to Server

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Deploy to Server
        run: |
          ssh erpnext@158.178.235.197 "cd /home/erpnext/frappe-bench/apps/custom_app && git pull upstream main"

It shows this error: Host key verification failed.

If anyone here expert in github CI/CD, please help me to automate this simple action.

You Need to Setup the Self-hosted (Search Github Self hosted Runners on) one and need to generate ssh key and add the public key to deployment server

runs-on: self-hosted

@erpnapps, Thank you for the reply.

I created ssh key and add the public key in my server and added to github.

@erpnapps I added

runs-on: self-hosted

Now shows thsese error.

erpnext@158.178.235.197: Permission denied (publickey).
Error: Process completed with exit code 255.

Why this showing? I added id_rsa.pub key to github ssh.

Try adding this action

2 Likes

Thank you so much. I can connect to the server and pull to the given branch.

Now I want to give bench migrate and bench restart command from the workflow. Migrate is running ok. But on restart showing this error:

How can resolve this issue, can anyone suggest me please?

why not run bench update --apps custom_app ?