From 586c854401699a312fd6269b5d01d4298e29481a Mon Sep 17 00:00:00 2001 From: Vu Anh Date: Wed, 23 Oct 2024 16:19:00 +0000 Subject: [PATCH] update --- .github/workflows/deploy-languages-v2-web.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-languages-v2-web.yml b/.github/workflows/deploy-languages-v2-web.yml index db4152ca..37ec93ed 100644 --- a/.github/workflows/deploy-languages-v2-web.yml +++ b/.github/workflows/deploy-languages-v2-web.yml @@ -12,6 +12,7 @@ jobs: runs-on: ubuntu-latest env: PROJECT_PATH: apps/languagesv2/languages-v2-web + TARGET_PATH: /root/apps steps: - uses: actions/checkout@v4 - name: Set up Node.js @@ -24,6 +25,10 @@ jobs: - name: Build React App working-directory: ${{ env.PROJECT_PATH }} run: npm run build + - name: Clean target folder on remote server + run: | + sshpass -p "${{ secrets.UTS_PASSWORD }}" ssh -o StrictHostKeyChecking=no ${{ secrets.UTS_USERNAME }}@${{ secrets.UTS_HOST }} -p ${{ secrets.UTS_PORT }} " + rm -rf ${{ env.TARGET_PATH }}/*" - name: Copy file via ssh password uses: appleboy/scp-action@v0.1.7 with: @@ -32,5 +37,9 @@ jobs: password: ${{ secrets.UTS_PASSWORD }} port: ${{ secrets.UTS_PORT }} source: "${{ env.PROJECT_PATH }}/build/*" - target: "/root/apps2" - recursive: true \ No newline at end of file + target: "${{ env.TARGET_PATH }}" + recursive: true + - name: Move build files to target folder on remote server + run: | + sshpass -p "${{ secrets.UTS_PASSWORD }}" ssh -o StrictHostKeyChecking=no ${{ secrets.UTS_USERNAME }}@${{ secrets.UTS_HOST }} -p ${{ secrets.UTS_PORT }} + "mv ${{ env.TARGET_PATH }}/${{ env.PROJECT_PATH }}/build/* ${{ env.TARGET_PATH }}/ && rm -rf ${{ env.TARGET_PATH }}/apps" \ No newline at end of file