From 48ea1c079b8de4de8b639db8815a5cd26e3e2fc3 Mon Sep 17 00:00:00 2001 From: jc <46619361+juancwu@users.noreply.github.com> Date: Sun, 8 Dec 2024 23:52:15 -0500 Subject: [PATCH] running frontend staging deployment action --- ...ontend.yml => deploy-staging-frontend.yml} | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) rename .github/workflows/{deploy-preview-frontend.yml => deploy-staging-frontend.yml} (70%) diff --git a/.github/workflows/deploy-preview-frontend.yml b/.github/workflows/deploy-staging-frontend.yml similarity index 70% rename from .github/workflows/deploy-preview-frontend.yml rename to .github/workflows/deploy-staging-frontend.yml index 0380ebfd..025a4545 100644 --- a/.github/workflows/deploy-preview-frontend.yml +++ b/.github/workflows/deploy-staging-frontend.yml @@ -9,6 +9,7 @@ on: jobs: build-and-deploy-frontend: runs-on: ubuntu-latest + environment: Staging defaults: run: shell: bash @@ -37,15 +38,20 @@ jobs: restore-keys: | ${{ runner.os }}-pnpm-store- - name: Install dependencies - run: cd frontend && pnpm install --frozen-lockfile + run: pnpm install --frozen-lockfile + - name: Build environment + run: | + cat << EOF > .env + VITE_API_URL=${{ secrets.BACKEND_URL }}/api/v1 + EOF - name: Build - run: cd frontend && pnpm build + run: pnpm build - name: Deploy to server uses: appleboy/scp-action@master with: - host: ${{ secrets.PREVIEW_SERVER_IP }} - username: ${{ secrets.PREVIEW_USER }} - key: ${{ secrets.PREVIEW_SERVER_SSH_KEY }} - source: "frontend/dist/" - target: "${{ secrets.TARGET_DIR }}" - strip_components: 1 + host: ${{ secrets.VPS_IP }} + username: ${{ secrets.VPS_USER }} + key: ${{ secrets.VPS_KEY }} + source: "frontend/dist/*" + target: "${{ secrets.FE_DIR }}" + strip_components: 2