This is GitHub OAuth2 server for NetlifyCMS , which is intended to deployed to Firebase Functions.
Fork and clone this repo. Then,
npm install
Vist https://github.com/settings/developers (or https://github.com/organizations/<YOUR_GITHUB_ORG>/settings/applications
) and register a new OAuth application.
Application name
- freeHomepage URL
- freeApplication description
- freeAuthorization callback URL
-https://asia-northeast1-<YOUR_FIREBASE_PROJECT_ID>.cloudfunctions.net/oauth/callback
If you don't have Firebase projects yet here, you can change the callback url after created it.
In yours projects modify config.yml
file:
backend:
name: github
repo: <YOUR_GITHUB_ID_OR_ORG>/netlifycms-oauth-server
branch: main # Or branch you want to update
base_url: https://asia-northeast1-<YOUR_FIREBASE_PROJECT_ID>.cloudfunctions.net
auth_endpoint: /oauth/auth
npx firebase login
npx firebase use <YOUR_FIREBASE_PROJECT_ID>
npx firebase functions:config:set oauth.client_id=<GITHUB_OAUTH_APP_CLIENTID> oauth.client_secret=<GITHUB_OAUTH_APA_CLIENTSECRET>
build
npx shadow-cljs watch app
run server
node out/netlifycms-oauth-server.js
connect repl
npx shadow-cljs cljs-repl
cp package.json functions/
cp .runtimeconfig.json functions/
# or
# npx firebase functions:config:get > functions/.runtimeconfig.json
npx shadow-cljs compile functions
npx firebase login
npx firebase use <YOUR_FIREBASE_PROJECT_ID>
npx firebase serve -p 5001
build release js file
npx shadow-cljs release functions
cp package.json functions/
deploy to Firebase Function
npx firebase use <YOUR_FIREBASE_PROJECT_ID>
npx firebase deploy --only functions:oauth
npx shadow-cljs release example-functions
cp package.json functions/
npx firebase deploy --only functions:example
- CI/CD. But this type of app is not frequently released.
- Other Git Service support e.g. GitLab, GitHub Enterprise