Skip to content

Instantly share code, notes, and snippets.

@padenot
Last active June 3, 2022 14:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save padenot/b4715c2b7cc03b51739725cf4d424794 to your computer and use it in GitHub Desktop.
Save padenot/b4715c2b7cc03b51739725cf4d424794 to your computer and use it in GitHub Desktop.

Install netlify:

npm install -g netlify-cli

Set it up like so, this will open a few web pages and create a netlify account with github login, authorize netlify, setup the github hook for deploy, etc.:

repositories/ringbuf.js::master$ netlify init
Logging into your Netlify account...
Opening https://app.netlify.com/authorize?response_type=ticket&ticket=e527b77c4d5c2a95a57c063ccb193459

You are now logged into your Netlify account!

Run netlify status for account details

To see all available commands run: netlify help

? What would you like to do? +  Create & configure a new site
? Team: Paul Adenot's team
Choose a unique site name (e.g. super-cool-site-by-padenot.netlify.app) or leave it blank for a random name. You can update the site name later.
? Site name (optional): ringbuf-js

Site Created

Admin URL: https://app.netlify.com/sites/ringbuf-js
URL:       https://ringbuf-js.netlify.app
Site ID:   xxx

? Netlify CLI needs access to your GitHub account to configure Webhooks and Deploy Keys. What would you like to do? Authorize with GitHub through app.netlify.com
? Your build command (hugo build/yarn run build/etc): npm run-script build
? Directory to deploy (blank for current dir): example

Creating Netlify Github Notification Hooks...
Netlify Notification Hooks configured!

Success! Netlify CI/CD Configured!

This site is now configured to automatically deploy from github branches & pull requests

Next steps:

  git push       Push to your git repository to trigger new site builds
  netlify open   Open the Netlify admin URL of your site
  

And then configure netlify to serve the headers:

cd examples
echo "/*" > _headers
echo "  Cross-Origin-Opener-Policy: same-origin" >> _headers
echo "  Cross-Origin-Embedder-Policy: require-corp" >> _headers
cd -
git add . .* #also adds the .netlify directory
git commit -m"add netlify config"
git push

Voilà.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment