Skip to content

A simple Node app for deploying to Glitch after push to GitHub repo.

Notifications You must be signed in to change notification settings

brimarq/glitch-deploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Glitch Deploy

This simple app adds a GitHub Webhook endpoint to Glitch's hello-express app, that employs HMAC signature verification to deploy to Glitch upon push events from a GitHub repository.

Inspired by Git Glitched, code for the endpoint route is adapted from this article.

Setup

  • Fork this repo on GitHub.
  • On Glitch, create a new project with the option to "Clone from Git Repo", using the git URL from your newly created fork (e.g. https://github.com/username/reponame.git). When the new project loads, replace the contents of .env with the contents of .env.example there. After doing this, the .env.example on Glitch can be deleted.
  • Clone your fork from GitHub to your computer.
  • In your local project, rename .env.example to .env.
  • In your computer's terminal, cd to your project root directory and run npm run mksecret. Copy the output hex string and paste it as the value to SECRET in the .env file, both in your local project and on Glitch.
  • Back in your GitHub repo's webhooks settings (https://github.com/username/reponame/settings/hooks), create a new webhook setting the payload URL to your Glitch project's endpoint (https://your-project-name.glitch.me/glitch-deploy), content type to application/json, secret to the value of SECRET in the .env file, and triggering events as "Just the push event.".
  • Now you're ready to go! When you push to GitHub from your local project, the webhook will automatically notify your Glitch project to pull in the new changes.

Start

  • Install dependencies with npm install.
  • To start the app with nodemon run npm run dev. Otherwise, npm start.

NOTE:

  • By default, the Glitch project will pull from the repo master branch. If you create additional branches in your repo and want it to pull from a different one, just uncomment the PULL_BRANCH variable in the project .env file on Glitch (this file is untracked), and add your preferred branch as the value (e.g. PULL_BRANCH=glitch).


Welcome to Glitch

Click Show in the header to see your app live. Updates to your code will instantly deploy and update live.

Glitch is the friendly community where you'll build the app of your dreams. Glitch lets you instantly create, remix, edit, and host an app, bot or site, and you can invite collaborators or helpers to simultaneously edit code with you.

Find out more about Glitch.

Your Project

On the front-end,

  • edit public/client.js, public/style.css and views/index.html
  • drag in assets, like images or music, to add them to your project

On the back-end,

  • your app starts at server.js
  • add frameworks and packages in package.json
  • safely store app secrets in .env (nobody can see this but you and people you invite)

Made by Glitch

\ ゜o゜)ノ

About

A simple Node app for deploying to Glitch after push to GitHub repo.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published