From 7ff2835ef639347513501e93a514f14119e2566a Mon Sep 17 00:00:00 2001 From: Abdulrahman Khalil <20816524+askhalil@users.noreply.github.com> Date: Sun, 20 Oct 2024 13:27:18 +0300 Subject: [PATCH] add ssh --- .github/workflows/ci.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df1adc6..e147318 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ name: Build and Run Go Program -on: [pull_request] +on: [push] jobs: build: @@ -10,6 +10,19 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: SSH + env: + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + SSH_USERNAME: ${{ secrets.SSH_USERNAME }} + SSH_HOST: ${{ secrets.SSH_HOST }} + run: | + mkdir -p /home/runner/.ssh + ssh-keyscan $SSH_HOST >> /home/runner/.ssh/known_hosts + echo "$SSH_PRIVATE_KEY" > /home/runner/.ssh/github_actions + chmod 600 /home/runner/.ssh/github_actions + ssh-agent -a $SSH_AUTH_SOCK > /dev/null + ssh-add /home/runner/.ssh/github_actions + ssh $SSH_USERNAME@$SSH_HOST "echo 'Hello from GitHub Actions'" - name: Set up Go uses: actions/setup-go@v3 with: