Staticman Netlify serverless functions port & simplification, forked from Staticman
- upgraded all JS to use ES Modules/
import(not commonJS/require) - dropped gitlab option (to simplify)
- only allow the safest/newest 'Authenticate as a GitHub application' option from https://staticman.net/docs/getting-started.html
- setup to run on
netlify - pared down config, JS files
- did a bit of
eslintcleaning, removed some side-effects, etc. - ported code from
nodetodeno(in alternate "serverless edge" branch nameddeno)
- fork this repo 'staticmin'
- tie this forked repo into
netlify- this link shows how to get the
ntlbinary, and hook in your forked repo tonetlifyfor deploying, viantl loginandntl init, etc. - you'll end up:
- adding a new GitHub 'deploy key' to your blog repo that
ntlcreates for you - adding a
webhookto your blog repo that has individual events (allowances): Branch or tag deletionPull requestsPushes
- adding a new GitHub 'deploy key' to your blog repo that
- this link shows how to get the
- setup a GitHub Application with access to the other GitHub repo with your static site blog
- copy the GitHub setup info (App ID (number) and GitHub RSA private key (string)) into the forked 'staticmin' repo's
netlifysetup asnetlifysecrets - you should have these 2 secrets as environment variables configured in your https://app.netlify.com setup:
GITHUB_APP_IDGITHUB_PRIVATE_KEY
To avoid encoding / secret / transport / environment variable issues, simply substitute any [NEWLINE] character in your private key string to [SPACE] characters, copy it into your netlify admin area environment variables (as secrets), and the updated lib/Staticman.js code will massage it properly.
To simplify setup, if you needed for some reason to have encrypted data in your staticman.yml file, we'll use your (RSA) githubPrivateKey to encrypt the data (so you don't have to generate another RSA key).