fix: deploy via tarball+scp+ssh (single file transfer, not many files)
Previous appleboy/scp-action source '.next/*' was trying to transfer hundreds of individual files — possibly timing out. Now tar .next into a single tarball, SCP that, and SSH to unpack + restart.
This commit is contained in:
@@ -34,7 +34,6 @@ jobs:
|
|||||||
run: bun run build
|
run: bun run build
|
||||||
|
|
||||||
# Upload the built .next directory (hidden dir → include-hidden-files).
|
# Upload the built .next directory (hidden dir → include-hidden-files).
|
||||||
# The deploy job downloads this and copies to the VPS — no build on VPS.
|
|
||||||
- name: Upload web build artifact
|
- name: Upload web build artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@@ -71,27 +70,21 @@ jobs:
|
|||||||
name: mcpedia-web-build
|
name: mcpedia-web-build
|
||||||
path: apps/web/.next
|
path: apps/web/.next
|
||||||
|
|
||||||
- name: List downloaded files
|
- name: Tar .next
|
||||||
working-directory: apps/web
|
run: tar -C apps/web -czf mcpedia-web-next.tar.gz .next
|
||||||
run: ls -la .next/ | head -10
|
|
||||||
|
|
||||||
# Tar .next on the runner (handles hidden files correctly),
|
- name: Deploy to VPS (SCP + SSH)
|
||||||
# then SCP the tarball to VPS and SSH to unpack + restart.
|
|
||||||
- name: Create deploy tarball
|
|
||||||
working-directory: apps/web
|
|
||||||
run: tar -czf ../../mcpedia-web-next.tar.gz .next
|
|
||||||
|
|
||||||
- name: Copy tarball to VPS
|
|
||||||
uses: appleboy/scp-action@v1
|
uses: appleboy/scp-action@v1
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.SSH_DEPLOY_HOST }}
|
host: ${{ secrets.SSH_DEPLOY_HOST }}
|
||||||
port: ${{ secrets.SSH_DEPLOY_PORT }}
|
port: ${{ secrets.SSH_DEPLOY_PORT }}
|
||||||
username: ${{ secrets.SSH_DEPLOY_USER }}
|
username: ${{ secrets.SSH_DEPLOY_USER }}
|
||||||
key: ${{ secrets.SSH_DEPLOY_KEY }}
|
key: ${{ secrets.SSH_DEPLOY_KEY }}
|
||||||
|
rm: true
|
||||||
source: "mcpedia-web-next.tar.gz"
|
source: "mcpedia-web-next.tar.gz"
|
||||||
target: "/tmp/mcpedia-web-next.tar.gz"
|
target: "/tmp/"
|
||||||
|
|
||||||
- name: Deploy to VPS over SSH
|
- name: Unpack and restart on VPS
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.SSH_DEPLOY_HOST }}
|
host: ${{ secrets.SSH_DEPLOY_HOST }}
|
||||||
@@ -113,7 +106,7 @@ jobs:
|
|||||||
tar -xzf /tmp/mcpedia-web-next.tar.gz -C apps/web/
|
tar -xzf /tmp/mcpedia-web-next.tar.gz -C apps/web/
|
||||||
rm -f /tmp/mcpedia-web-next.tar.gz
|
rm -f /tmp/mcpedia-web-next.tar.gz
|
||||||
|
|
||||||
# Restart services to pick up the new build
|
# Restart services
|
||||||
sudo systemctl restart mcpedia-web mcpedia-api mcpedia-mcp mcpedia-worker
|
sudo systemctl restart mcpedia-web mcpedia-api mcpedia-mcp mcpedia-worker
|
||||||
sleep 3
|
sleep 3
|
||||||
systemctl --no-pager status mcpedia-web mcpedia-api mcpedia-mcp mcpedia-worker --no-legend
|
systemctl --no-pager status mcpedia-web mcpedia-api mcpedia-mcp mcpedia-worker --no-legend
|
||||||
|
|||||||
Reference in New Issue
Block a user