From 7a8ad2e6af46cddd9af419f7c37971e2e361b1f8 Mon Sep 17 00:00:00 2001 From: Sushil Chaudhary Date: Tue, 12 Dec 2023 21:55:57 +0530 Subject: [PATCH] add key file --- .github/workflows/doc.nuxeo.com.yml | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/doc.nuxeo.com.yml b/.github/workflows/doc.nuxeo.com.yml index ae9dc087..ca59c8b7 100644 --- a/.github/workflows/doc.nuxeo.com.yml +++ b/.github/workflows/doc.nuxeo.com.yml @@ -12,9 +12,13 @@ jobs: environment: name: ${{ github.ref == 'refs/heads/master' && 'production' || github.ref == 'refs/heads/development' && 'development' || '' }} - - build-and-deploy: + steps: + - name: Set up SSH + uses: webfactory/ssh-agent@v0.8.0 + with: + ssh-private-key: ${{ secrets.SERVER_SSH_PRIVATE_KEY }} + - name: Checkout code uses: actions/checkout@v4 @@ -23,6 +27,11 @@ jobs: with: node-version: '14' + - name: Set up SSH + uses: webfactory/ssh-agent@v0.8.0 + with: + ssh-private-key: ${{ secrets.SERVER_SSH_PRIVATE_KEY }} + - name: Check Versions and Save to File run: | echo "git $(git --version)" > runtime-versions.txt @@ -42,18 +51,16 @@ jobs: echo > redirects_pageid.txt - name: Deploy to Server - with: - SERVER_SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_PRIVATE_KEY }} run: | - rsync -Waxvuk --delete site/ ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}:/opt/www/doc/ - sync redirects.txt ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}:/etc/nginx/redirects.txt - rsync redirects_pageid.txt ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}:/etc/nginx/redirects_pageid.txt + rsync -Wxvuk --delete -e "ssh -i ${{ secrets.SERVER_SSH_PRIVATE_KEY }}" site/ "${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}:/opt/www/doc/" + rsync -e "ssh -i ${{ secrets.SERVER_SSH_PRIVATE_KEY }}" redirects.txt "${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}:/etc/nginx/redirects.txt" + rsync -e "ssh -i ${{ secrets.SERVER_SSH_PRIVATE_KEY }}" redirects_pageid.txt ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}:/etc/nginx/redirects_pageid.txt - name: Nginx Config Test and Restart run: | ssh -i "${{ secrets.SERVER_SSH_PRIVATE_KEY }}" \ - "${{ secrets.USERNAME }}@${{ secrets.SERVER_IP }}" \ - "service nginx configtest && service nginx restart" + "${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}" \ + "service nginx configtest && service nginx restart" - name: Archive Artifacts uses: actions/upload-artifact@v3