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
|
||||
|
||||
# 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
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -71,27 +70,21 @@ jobs:
|
||||
name: mcpedia-web-build
|
||||
path: apps/web/.next
|
||||
|
||||
- name: List downloaded files
|
||||
working-directory: apps/web
|
||||
run: ls -la .next/ | head -10
|
||||
- name: Tar .next
|
||||
run: tar -C apps/web -czf mcpedia-web-next.tar.gz .next
|
||||
|
||||
# Tar .next on the runner (handles hidden files correctly),
|
||||
# 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
|
||||
- name: Deploy to VPS (SCP + SSH)
|
||||
uses: appleboy/scp-action@v1
|
||||
with:
|
||||
host: ${{ secrets.SSH_DEPLOY_HOST }}
|
||||
port: ${{ secrets.SSH_DEPLOY_PORT }}
|
||||
username: ${{ secrets.SSH_DEPLOY_USER }}
|
||||
key: ${{ secrets.SSH_DEPLOY_KEY }}
|
||||
rm: true
|
||||
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
|
||||
with:
|
||||
host: ${{ secrets.SSH_DEPLOY_HOST }}
|
||||
@@ -113,7 +106,7 @@ jobs:
|
||||
tar -xzf /tmp/mcpedia-web-next.tar.gz -C apps/web/
|
||||
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
|
||||
sleep 3
|
||||
systemctl --no-pager status mcpedia-web mcpedia-api mcpedia-mcp mcpedia-worker --no-legend
|
||||
|
||||
Reference in New Issue
Block a user