Created
December 23, 2018 20:50
-
-
Save rusenask/93ddb94479fbd6f1e3dcf3308da4ec1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "889ee9b.7067c18", | |
"type": "tab", | |
"label": "Brew formula update", | |
"disabled": false, | |
"info": "" | |
}, | |
{ | |
"id": "a5a4f493.377b68", | |
"type": "webhookrelay", | |
"z": "889ee9b.7067c18", | |
"buckets": "nodered, cloudbuilder", | |
"x": 110, | |
"y": 140, | |
"wires": [ | |
[ | |
"fe3dcf90.10c67" | |
] | |
] | |
}, | |
{ | |
"id": "fe3dcf90.10c67", | |
"type": "switch", | |
"z": "889ee9b.7067c18", | |
"name": "", | |
"property": "topic", | |
"propertyType": "msg", | |
"rules": [ | |
{ | |
"t": "eq", | |
"v": "cloudbuilder", | |
"vt": "str" | |
} | |
], | |
"checkall": "true", | |
"repair": false, | |
"outputs": 1, | |
"x": 110, | |
"y": 260, | |
"wires": [ | |
[ | |
"d117d48a.8bd808" | |
] | |
] | |
}, | |
{ | |
"id": "d117d48a.8bd808", | |
"type": "http request", | |
"z": "889ee9b.7067c18", | |
"name": "download darwin binary", | |
"method": "GET", | |
"ret": "bin", | |
"url": "https://storage.googleapis.com/webhookrelay/downloads/relay-darwin-amd64", | |
"tls": "", | |
"x": 310, | |
"y": 260, | |
"wires": [ | |
[ | |
"25d481d0.d11c2e" | |
] | |
] | |
}, | |
{ | |
"id": "64087d33.b2a574", | |
"type": "debug", | |
"z": "889ee9b.7067c18", | |
"name": "", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "true", | |
"x": 550, | |
"y": 340, | |
"wires": [] | |
}, | |
{ | |
"id": "eeb7aaab.cad0a8", | |
"type": "github-repo", | |
"z": "889ee9b.7067c18", | |
"github": "", | |
"name": "update brew file", | |
"username": "webhookrelay", | |
"usernameType": "str", | |
"repository": "homebrew-tap", | |
"repositoryType": "str", | |
"action": "write", | |
"branch": "master", | |
"branchType": "str", | |
"path": "relay.rb", | |
"pathType": "str", | |
"pathto": "", | |
"pathtoType": "str", | |
"contents": "payload", | |
"contentsType": "msg", | |
"outputs": "0", | |
"x": 580, | |
"y": 380, | |
"wires": [] | |
}, | |
{ | |
"id": "3d5fac52.d118b4", | |
"type": "template", | |
"z": "889ee9b.7067c18", | |
"name": "generate relay.rb", | |
"field": "payload", | |
"fieldType": "msg", | |
"format": "handlebars", | |
"syntax": "mustache", | |
"template": "class Relay < Formula \n desc \"Client for Webhook Relay service - demo websites from localhost and receive webhooks behind firewalls and NAT\"\n homepage \"https://webhookrelay.com\"\n url \"https://storage.googleapis.com/webhookrelay/downloads/relay-darwin-amd64\"\n sha256 \"{{payload}}\"\n\n def install \n mv \"relay-darwin-amd64\", \"relay\"\n bin.install \"relay\"\n end\n\n test do\n system \"#{bin}/relay\", \"--version\"\n end\nend", | |
"output": "str", | |
"x": 330, | |
"y": 380, | |
"wires": [ | |
[ | |
"64087d33.b2a574", | |
"eeb7aaab.cad0a8" | |
] | |
] | |
}, | |
{ | |
"id": "2f862fd1.aa7e", | |
"type": "comment", | |
"z": "889ee9b.7067c18", | |
"name": "writing our downloaded binary to disk and generating sha256", | |
"info": "", | |
"x": 500, | |
"y": 200, | |
"wires": [] | |
}, | |
{ | |
"id": "c649c24f.a5d91", | |
"type": "function", | |
"z": "889ee9b.7067c18", | |
"name": "sha256", | |
"func": "var require = global.get('require');\nvar crypto = require('crypto');\nvar fs = require('fs');\n\nvar algo = 'sha256';\nvar shasum = crypto.createHash(algo);\n\nvar file = '/tmp/relay-darwin-amd64-nr';\nvar s = fs.ReadStream(file);\n\ns.on('data', function(d) { shasum.update(d); });\ns.on('end', function() {\n var sum = shasum.digest('hex');\n node.send({payload: sum});\n \n});\n\nreturn;", | |
"outputs": 1, | |
"noerr": 0, | |
"x": 120, | |
"y": 380, | |
"wires": [ | |
[ | |
"94359551.b49908", | |
"3d5fac52.d118b4", | |
"5e338b2d.eabb74" | |
] | |
] | |
}, | |
{ | |
"id": "eb37953a.602c58", | |
"type": "http request", | |
"z": "889ee9b.7067c18", | |
"name": "webhook to Slack", | |
"method": "POST", | |
"ret": "txt", | |
"url": "https://hooks.slack.com/services/[ADD YOUR WEBHOOK ENDPOINT]", | |
"tls": "", | |
"x": 550, | |
"y": 440, | |
"wires": [ | |
[ | |
"4f3c54cc.28165c" | |
] | |
] | |
}, | |
{ | |
"id": "94359551.b49908", | |
"type": "template", | |
"z": "889ee9b.7067c18", | |
"name": "gen slack message", | |
"field": "payload", | |
"fieldType": "msg", | |
"format": "handlebars", | |
"syntax": "mustache", | |
"template": "{\n \"response_type\": \"in_channel\",\n \"text\": \"Brew formula SHA updated to: {{payload}}\"\n}", | |
"output": "str", | |
"x": 330, | |
"y": 440, | |
"wires": [ | |
[ | |
"eb37953a.602c58" | |
] | |
] | |
}, | |
{ | |
"id": "4f3c54cc.28165c", | |
"type": "debug", | |
"z": "889ee9b.7067c18", | |
"name": "", | |
"active": true, | |
"tosidebar": true, | |
"console": false, | |
"tostatus": false, | |
"complete": "false", | |
"x": 750, | |
"y": 440, | |
"wires": [] | |
}, | |
{ | |
"id": "25d481d0.d11c2e", | |
"type": "file", | |
"z": "889ee9b.7067c18", | |
"name": "write relay-darwin-amd64 to disk", | |
"filename": "/tmp/relay-darwin-amd64-nr", | |
"appendNewline": true, | |
"createDir": false, | |
"overwriteFile": "true", | |
"x": 590, | |
"y": 260, | |
"wires": [ | |
[ | |
"c649c24f.a5d91" | |
] | |
] | |
}, | |
{ | |
"id": "5e338b2d.eabb74", | |
"type": "file", | |
"z": "889ee9b.7067c18", | |
"name": "delete file", | |
"filename": "/tmp/relay-darwin-amd64-nr", | |
"appendNewline": true, | |
"createDir": false, | |
"overwriteFile": "delete", | |
"x": 300, | |
"y": 500, | |
"wires": [ | |
[] | |
] | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment