diff --git a/.github/workflows/deploy-staging-backend.yml b/.github/workflows/deploy-staging-backend.yml index e6e6fa8..2bdb84a 100644 --- a/.github/workflows/deploy-staging-backend.yml +++ b/.github/workflows/deploy-staging-backend.yml @@ -152,7 +152,7 @@ jobs: key: ${{ secrets.VPS_KEY }} envs: DB_NAME,DB_PASSWORD,DB_PORT,DB_SSLMODE,DB_USER,APP_NAME,APP_ENV script: | - cd $HOME/staging + cd $HOME/$APP_ENV echo "Stopping and removing existing container if present..." CONTAINER="$APP_NAME-$APP_ENV" diff --git a/.github/workflows/deploy-staging-frontend.yml b/.github/workflows/deploy-staging-frontend.yml index 025a454..8e6851b 100644 --- a/.github/workflows/deploy-staging-frontend.yml +++ b/.github/workflows/deploy-staging-frontend.yml @@ -17,6 +17,14 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + - name: Setup VPS fingerprint + run: | + mkdir -p ~/.ssh + echo "${{ secrets.VPS_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + echo "${{ secrets.VPS_IP }} ${{ secrets.VPS_FINGERPRINT }}" >> ~/.ssh/known_hosts + - name: Setup Rsync + uses: GuillaumeFalourd/setup-rsync@v1.2 - name: Setup pnpm uses: pnpm/action-setup@v4 with: @@ -47,11 +55,5 @@ jobs: - name: Build run: pnpm build - name: Deploy to server - uses: appleboy/scp-action@master - with: - host: ${{ secrets.VPS_IP }} - username: ${{ secrets.VPS_USER }} - key: ${{ secrets.VPS_KEY }} - source: "frontend/dist/*" - target: "${{ secrets.FE_DIR }}" - strip_components: 2 + run: | + rsync -avz --progress dist/* "${{ secrets.VPS_USER }}@${{ secrets.VPS_IP }}:~/${{ secrets.APP_ENV }}/frontend"