Surge deployments in 2 minutes
July 7, 2018
tl;dr
code
# install with npm
npm install --global surge
# OR install with yarn
yarn global add surge
# run
surge
- Enter an email and password to signup or login
- Select a directory to publish
- Enter a domain name
- Done!
deployments
If you're already authenticated, you can directly pass in the directory with the surge command
code
# deploy a directory
surge /public
code
# deploy folder while passing the domain name as parameter
surge public/ --domain myfooo.surge.sh
save your domain name to a CNAME file
You can pass the domain name as a CLI parameter
code
surge --domain myfooo.surge.sh
Or you can save it as a CNAME file
code
echo myfooo.surge.sh > CNAME
When developing with Gastby, the CNAME file needs to be in the root directory or in the static folder so that it gets copied to your public folder upon build.
using a custom domain
Point your domain to na-west1.surge.sh or 45.55.110.124
code
# with a CNAME record (@, www)
na-west1.surge.sh
code
# with an A/AAA record (*)
45.55.110.124
code
# deploy to your custom domain
surge path-to-project/ mydomain.com
# save custom domain name to avoid entering it every time
echo mydomain.com > CNAME