swas-deploy

Deploys the Era frontend to an Alibaba Cloud SWAS server via SSH and rebuilds it remotely.

Updated Jul 8, 2026
One-click install
npx skills add https://github.com/bibidu/era --skill swas-deploy-bibidu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swas-deploy
Source: https://github.com/bibidu/era/tree/main/.agents/skills/swas-deploy
Command: npx skills add https://github.com/bibidu/era --skill swas-deploy-bibidu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Publishing frontend changes to a self-hosted Alibaba Cloud lightweight server is slow and error-prone when done manually, especially when building locally and transferring large bundles across regions. This Skill automates the full release path: push to main, SSH into the server, pull the latest code, build on the server, sync the output, and reload the gateway. ## Core Features & Use Cases - Server-side build pipeline: Runs git fetch + reset --hard origin/main, npm ci, and ERA_BASE=/ npm run build directly on the server, avoiding slow cross-border rsync of local build artifacts. - Automated sync and reload: Syncs dist/ to /opt/era-web and reloads the era-gateway (Caddy) service, then verifies the site with curl. - Secrets and fallback handling: Loads Aliyun credentials from deploy/swas/server.secrets.env (gitignored) and provides a recovery path via cloud assistant when the SSH key fails. - Use Case: After a PR is merged into main, trigger the deployment and receive the HTTPS preview URL https://39.106.179.17.sslip.io/ to share with stakeholders. ## Quick Start Deploy the latest main branch to the self-hosted site and give me back the HTTPS URL.

Frequently Asked Questions about swas-deploy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I deploy a frontend to an Alibaba Cloud SWAS server?

Push your changes to the main branch, then run npm run deploy:swas. The script SSHs into the server, resets to origin/main, runs npm ci and the build, syncs dist to /opt/era-web, and reloads the gateway service.

Why build on the server instead of rsyncing a local build?

Cross-border transfers from a cloud agent in the US west to Beijing are very slow for large bundles. Building on the server with npm ci and vite avoids transferring artifacts and only requires a git fetch of the latest main branch.

Where should Aliyun AccessKey secrets be stored for deployment?

Store ALIYUN_ACCESS_KEY_ID and ALIYUN_ACCESS_KEY_SECRET in deploy/swas/server.secrets.env, which is gitignored. GitHub Push Protection blocks plaintext AccessKeys, so only the example template is committed to the repository.

What happens if the SSH private key stops working?

Use the Aliyun credentials in server.secrets.env with the swas-open cloud assistant to write id_rsa.pub back into /root/.ssh/authorized_keys on the server. After restoring access, rerun npm run deploy:swas normally.

How is a successful deployment verified?

Run curl -I against https://39.106.179.17.sslip.io/ and expect a 200 response, and confirm any new deep links such as ?tab=stitch open correctly. A GitHub Actions link alone is not accepted as delivery proof.