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