Trying to set up Github actions. Workflow is to start Dokku deployment on merged PR to main branch: .github/workflows/dokku.yml
on:
pull_request:
branches: [main]
types:
- closed
jobs:
if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- id: deploy
name: Deploy to dokku
uses: idoberko2/dokku-deploy-github-action@v1
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
dokku-host: '123.123.123.123'
app-name: 'testapp'
remote-branch: 'main'
Step 'Deploy to dokku' give an error:
Run idoberko2/dokku-deploy-github-action@v1
/usr/bin/docker run --name cd98f7e739ac6046d41c39b90a6cfa22a8060_137fd0
--label 4cd98f --workdir /github/workspace --rm -e INPUT_SSH-PRIVATE-KEY
-e INPUT_DOKKU-HOST -e INPUT_APP-NAME -e INPUT_REMOTE-BRANCH -e INPUT_DOKKU-USER
-e INPUT_GIT-PUSH-FLAGS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA
-e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER
-e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW
-e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL
-e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED
-e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH
-e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV
-e GITHUB_STEP_SUMMARY -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE
-e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN
-e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock"
-v "/home/runner/work/_temp/_github_home":"/github/home"
-v "/home/runner/work/_temp/_github_workflow":"/github/workflow"
-v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands"
-v "/home/runner/work/test/test":"/github/workspace"
4cd98f:7e739ac6046d41c39b90a6cfa22a8060 "***" "dokku" "123.123.123.123" "testapp" "main" ""
Agent pid 11
Error loading key "(stdin)": invalid format
# 123.123.123.123:22 SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.5
# 123.123.123.123:22 SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.5
# 123.123.123.123:22 SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.5
GIT_COMMAND=git push deploy 38f6c6ba47f4d40a7d19c5cf9a9b148ebb88996e:refs/heads/main
Warning: Permanently added '123.123.123.123' (ECDSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have t
he correct access rights
and the repository exists.
so, basically this lines:
Error loading key "(stdin)": invalid format
Warning: Permanently added '123.123.123.123' (ECDSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
I can deploy from my local machine with git push dokku
I added private ssh key to github secrets.
On remote server where Dokku lives, I have this:
dokku ssh-keys:list
SHA256:T4rHySQTzDRguZ0t7d7NhN2DlkNF0+kBfkxMU/P0zAk NAME="admin" SSHCOMMAND_ALLOWED_KEYS="no-agent-forwarding,no-user-rc,no-X11-forwarding,no-port-forwarding"
When adding ssh private key - we need to add new line at the end.. facepalm.