From 1bc13513ac9a2b79930996b0872fee16efbc36c8 Mon Sep 17 00:00:00 2001 From: Oliver Enes Date: Thu, 5 Sep 2024 05:12:52 +0200 Subject: [PATCH] fixed ssh --- .github/workflows/deploy.yml | 3 ++- deploy.sh | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0a3a5f5..8d32bac 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -24,4 +24,5 @@ jobs: DEPLOYMENT_RES_PATH: ${{ vars.DEPLOYMENT_RES_PATH }} DEPLOYMENT_SERVER: ${{ vars.DEPLOYMENT_SERVER }} DEPLOYMENT_USER: ${{ vars.DEPLOYMENT_USER }} - SSH_KEY: ${{ secrets.SSH_KEY }} \ No newline at end of file + SSH_KEY: ${{ secrets.SSH_KEY }} + SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }} \ No newline at end of file diff --git a/deploy.sh b/deploy.sh index 2c364c7..2f2e0b7 100755 --- a/deploy.sh +++ b/deploy.sh @@ -19,14 +19,19 @@ echo "" cd frontend npm install -npm run build:$BUILD_MODE +npm run bui +ld:$BUILD_MODE cd .. echo "" echo "--> Uploading to deployment server..." echo "" -ssh-add - <<< "${SSH_KEY}" +mkdir -p ~/.ssh/ +echo "$SSH_KEY" > ~/.ssh/deploy.key +sudo chmod 600 ~/.ssh/deploy.key +echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_host + ssh $DEPLOYMENT_USER@$DEPLOYMENT_SERVER "rm -rf $DEPLOYMENT_RES_PATH/*" scp -r dist $DEPLOYMENT_USER@$DEPLOYMENT_SERVER:$DEPLOYMENT_RES_PATH