Deploying to Surge.sh
Surge.sh is a simple, single-command static web publishing service. Portosaur supports automated deployments to Surge using GitHub Actions or GitLab CI.
1. Get your Surge Token
Before configuring Portosaur, you need to generate a Surge token from your local machine:
- Install the Surge CLI:
npm install -g surge - Login:
surge login - Get your token:
surge token
Keep this token safe; you'll need it for the CI/CD secrets.
2. Configure Portosaur
For New Projects
When running bunx portosaur init, first choose your preferred VCS Provider (e.g., GitHub, GitLab) and then select Surge.sh as your hosting platform.
For Existing Projects
If you already have a Portosaur project, run:
bunx portosaur init-ci --hosting surgeThe CLI will attempt to detect your git remote to pick the correct CI template.
3. Set Up Secrets
To allow the CI pipeline to deploy on your behalf, you must add the following secrets to your repository settings (Settings > Secrets and variables > Actions for GitHub, or Settings > CI/CD > Variables for GitLab):
| Secret Name | Value |
|---|---|
SURGE_LOGIN | Your Surge email address. |
SURGE_TOKEN | The token you generated in step 1. |
4. Deploy
Once configured, simply push your changes to the main branch. Your site will be automatically built and deployed to https://your-project-name.surge.sh.