⚠️ Portosaur & This docs is Work In Progress!
Skip to content

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:

  1. Install the Surge CLI: npm install -g surge
  2. Login: surge login
  3. 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:

bash
bunx portosaur init-ci --hosting surge

The 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 NameValue
SURGE_LOGINYour Surge email address.
SURGE_TOKENThe 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.