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
eslint
cleaning, removed some side-effects, etc. - ported code from
node
todeno
(in alternate "serverless edge" branch nameddeno
)
- fork this repo 'staticmin'
- tie this forked repo into
netlify
- this link shows how to get the
ntl
binary, and hook in your forked repo tonetlify
for deploying, viantl login
andntl init
, etc. - you'll end up:
- adding a new GitHub 'deploy key' to your blog repo that
ntl
creates for you - adding a
webhook
to your blog repo that has individual events (allowances): Branch or tag deletion
Pull requests
Pushes
- 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
netlify
setup asnetlify
secrets - you should have these 2 secrets as environment variables configured in your https://app.netlify.com setup:
GITHUB_APP_ID
GITHUB_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).