From e15a37a8f3033cc5e2f840d94aa0f1d86b411b50 Mon Sep 17 00:00:00 2001 From: shockrah Date: Thu, 5 Sep 2024 21:06:06 -0700 Subject: [PATCH 1/5] Testing anothe rmethod of pushing files to remote --- .gitea/workflows/build-and-deploy.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/build-and-deploy.yml b/.gitea/workflows/build-and-deploy.yml index 32adc0c..e11ab53 100644 --- a/.gitea/workflows/build-and-deploy.yml +++ b/.gitea/workflows/build-and-deploy.yml @@ -17,13 +17,10 @@ jobs: uses: actions/checkout@v4 - name: Build website content run: hugo - - name: Setup ssh agent - run: eval $(ssh-agent -s) - - name: Add private key to agent - run: echo "${{ secrets.PRIVATE_KEY }}" | ssh-add - > /dev/null - - name: Create tmp .ssh directory - run: mkdir -p ~/.ssh - - name: Ensure perms on tmp .ssh directory - run: chmod 0700 ~/.ssh - - name: SCP Files to resume web server - run: "scp -o UserKnownHostsFile=/dev/null -r public/ $ssh_target:$remote_path" + - name: SSH setup and copying + run: | + eval $(ssh-agent -s) \ + echo "${{ secrets.PRIVATE_KEY }}" | ssh-add - > /dev/null \ + mkdir -p ~/.ssh \ + chmod 0700 ~/.ssh \ + scp -o UserKnownHostsFile=/dev/null -r public/ $ssh_target:$remote_path From fbe088c395418144642187bfc402290750445cf7 Mon Sep 17 00:00:00 2001 From: shockrah Date: Thu, 5 Sep 2024 21:14:45 -0700 Subject: [PATCH 2/5] new method of setting up ssh-agent --- .gitea/workflows/build-and-deploy.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/build-and-deploy.yml b/.gitea/workflows/build-and-deploy.yml index e11ab53..f95ed0f 100644 --- a/.gitea/workflows/build-and-deploy.yml +++ b/.gitea/workflows/build-and-deploy.yml @@ -17,10 +17,13 @@ jobs: uses: actions/checkout@v4 - name: Build website content run: hugo - - name: SSH setup and copying - run: | - eval $(ssh-agent -s) \ - echo "${{ secrets.PRIVATE_KEY }}" | ssh-add - > /dev/null \ - mkdir -p ~/.ssh \ - chmod 0700 ~/.ssh \ - scp -o UserKnownHostsFile=/dev/null -r public/ $ssh_target:$remote_path + - name: Create tmp .ssh directory + run: mkdir -p ~/.ssh + - name: Ensure perms on tmp .ssh directory + run: chmod 0700 ~/.ssh + - name: Setup ssh agent + run: ssh-agent -a /tmp/ssh_agent.sock -s > /dev/null + - name: Add private key to agent + run: echo "${{ secrets.PRIVATE_KEY }}" | ssh-add - > /dev/null + - name: SCP Files to resume web server + run: "scp -o UserKnownHostsFile=/dev/null -r public/ $ssh_target:$remote_path" From 19e05b590159c6449bf7c3fcdccb6f4de4f7dd0e Mon Sep 17 00:00:00 2001 From: shockrah Date: Thu, 5 Sep 2024 21:17:48 -0700 Subject: [PATCH 3/5] Using gh action --- .gitea/workflows/build-and-deploy.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/build-and-deploy.yml b/.gitea/workflows/build-and-deploy.yml index f95ed0f..b601d01 100644 --- a/.gitea/workflows/build-and-deploy.yml +++ b/.gitea/workflows/build-and-deploy.yml @@ -17,13 +17,7 @@ jobs: uses: actions/checkout@v4 - name: Build website content run: hugo - - name: Create tmp .ssh directory - run: mkdir -p ~/.ssh - - name: Ensure perms on tmp .ssh directory - run: chmod 0700 ~/.ssh - - name: Setup ssh agent - run: ssh-agent -a /tmp/ssh_agent.sock -s > /dev/null - - name: Add private key to agent - run: echo "${{ secrets.PRIVATE_KEY }}" | ssh-add - > /dev/null + - name: Setup SSH to copy files up to remote webserver + uses: webfactory/ssh-agent@v0.9.0 - name: SCP Files to resume web server run: "scp -o UserKnownHostsFile=/dev/null -r public/ $ssh_target:$remote_path" From 88acf5221ad89eab14857d6156e041ff7160504a Mon Sep 17 00:00:00 2001 From: shockrah Date: Thu, 5 Sep 2024 21:19:08 -0700 Subject: [PATCH 4/5] Forgot private key in with config --- .gitea/workflows/build-and-deploy.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitea/workflows/build-and-deploy.yml b/.gitea/workflows/build-and-deploy.yml index b601d01..461dbdd 100644 --- a/.gitea/workflows/build-and-deploy.yml +++ b/.gitea/workflows/build-and-deploy.yml @@ -19,5 +19,7 @@ jobs: run: hugo - name: Setup SSH to copy files up to remote webserver uses: webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: ${{ secrets.PRIVATE_KEY }} - name: SCP Files to resume web server run: "scp -o UserKnownHostsFile=/dev/null -r public/ $ssh_target:$remote_path" From ef22fd9b8333a115599952cf32d3bf5f19275402 Mon Sep 17 00:00:00 2001 From: shockrah Date: Thu, 5 Sep 2024 21:28:34 -0700 Subject: [PATCH 5/5] setup known_hosts for ssh-keyscan --- .gitea/workflows/build-and-deploy.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitea/workflows/build-and-deploy.yml b/.gitea/workflows/build-and-deploy.yml index 461dbdd..bd9da0c 100644 --- a/.gitea/workflows/build-and-deploy.yml +++ b/.gitea/workflows/build-and-deploy.yml @@ -17,6 +17,8 @@ jobs: uses: actions/checkout@v4 - name: Build website content run: hugo + - name: Setup the hostname with the private key that we have + run: mkdir -p ~/.ssh/ && ssh-keyscan git.shockrah.xyz >> ~/.ssh/known_hosts - name: Setup SSH to copy files up to remote webserver uses: webfactory/ssh-agent@v0.9.0 with: