{"id":15595296,"url":"https://github.com/michaelherold/bridgetown-deploy_hook","last_synced_at":"2026-02-08T03:30:50.358Z","repository":{"id":141685139,"uuid":"612666769","full_name":"michaelherold/bridgetown-deploy_hook","owner":"michaelherold","description":"A Bridgetown plugin that adds a webhook for performing actions after a deploy","archived":false,"fork":false,"pushed_at":"2023-03-11T16:48:24.000Z","size":26,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-06T21:16:35.614Z","etag":null,"topics":["bridgetown-au","bridgetown-plugin","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelherold.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-11T16:16:44.000Z","updated_at":"2024-01-09T06:58:15.000Z","dependencies_parsed_at":"2024-02-20T06:45:17.766Z","dependency_job_id":null,"html_url":"https://github.com/michaelherold/bridgetown-deploy_hook","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/michaelherold/bridgetown-deploy_hook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelherold%2Fbridgetown-deploy_hook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelherold%2Fbridgetown-deploy_hook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelherold%2Fbridgetown-deploy_hook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelherold%2Fbridgetown-deploy_hook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelherold","download_url":"https://codeload.github.com/michaelherold/bridgetown-deploy_hook/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelherold%2Fbridgetown-deploy_hook/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29219252,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T03:18:47.732Z","status":"ssl_error","status_checked_at":"2026-02-08T03:15:31.985Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bridgetown-au","bridgetown-plugin","ruby"],"created_at":"2024-10-03T00:51:38.642Z","updated_at":"2026-02-08T03:30:50.343Z","avatar_url":"https://github.com/michaelherold.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bridgetown deploy hook plugin\n\nA [Bridgetown](https://www.bridgetownrb.com) plugin for triggering behavior via a webhook.\n\n## Installation\n\nRun this command to add this plugin to your site's Gemfile:\n\n    bundle add bridgetown-deploy_hook\n\nOr you can use [an automation script](https://www.bridgetownrb.com/docs/automations) instead for guided setup:\n\n    bin/bt apply https://github.com/michaelherold/bridgetown-deploy_hook\n\n## Usage\n\nTo use a post-deploy hook, you must run Bridgetown with the Roda app; a static website will not work. First, add the Roda plugin to your app and call the helper for enabling the route:\n\n```ruby\n# server/roda_app.rb\nclass RodaApp \u003c Bridgetown::Rack::Roda\n  plugin :bridgetown_ssr\n  plugin :bridgetown_deploy_hook\n  \n  route do |r|\n    r.bridgetown_deploy_hook\n  end\nend\n```\n\nNote that you must enable the plugin _after_ the `:bridgetown_ssr` plugin because the latter is what sets up your Bridgetown site for use by the Roda app.\n\nNext, configure your route and authorization methods using the initializer. For example, if you want `/my-deploy-hook` to be the route for your hook and use a static [Bearer token](https://datatracker.ietf.org/doc/html/rfc6750) from your environment variables as an authorization mechanism:\n\n```ruby\n# config/initializers.rb\n\nBridgetown.configure do\n  init(\n    \"bridgetown-deploy_hook\",\n    authorization: {\n      bearer: -\u003e(token) { token == ENV[\"BEARER_TOKEN\"] }\n    }\n    route: \"my-deploy-hook\"\n  )\nend\n```\n\nLastly, register the action that you want to run with the deploy hook:\n\n```ruby\n# config/initializers.rb\n# ... or any other auto-loaded file in your app\nBridgetown::Hooks.register_one :site, :post_deploy do |site|\n  # Your code here\nend\n```\n\n`site` is your `Bridgetown::Site` instance so you have access to all of your configuration and resources that you have configured.\n\n### Authorization\n\nYou may register anything that responds to `#call`, takes a string argument of the directives for your authorization type, and responds with a truthy value when authorization succeeds.\n\nEach [authorization scheme](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#authentication_schemes) may have a single handler registered to it. Register them with either the symbol or string cooresponding to the lowercase version of the scheme. For example, if you want to register both a [Basic](https://datatracker.ietf.org/doc/html/rfc7617) handler and a [Bearer](https://datatracker.ietf.org/doc/html/rfc6750) handler, that would look like the following:\n\n```ruby\n# config/initializers.rb\n\nBridgetown.configure do\n  init(\n    \"bridgetown-deploy_hook\",\n    authorization: {\n      basic: my_basic_handler,\n      bearer: my_bearer_handler,\n    }\n    route: \"my-deploy-hook\"\n  )\nend\n```\n\nThe **handlers receive the raw value from the header**, not a destructured version. So the Basic handler receives the Base64-encoded `user:password` pair, not the user and the password, so you must handle the parsing of the value appropriately for the authorization scheme.\n\n### Plugin authors\n\nPlugins may also interact with the deploy hook by registering their own [non-reloadable](https://www.bridgetownrb.com/docs/plugins/hooks#reloadable-vs-non-reloadable-hooks) hook handlers.\n\nAs an example:\n\n```ruby\nBridgetown::Hooks.register_one :site, :post_deploy, reloadable: false do |site|\n  MyPlugin.do_the_work(site)\nend\n```\n\n## Contributing\n\nSo you're interested in contributing to Bridgetown deploy hook? Check out our [contributing guidelines](CONTRIBUTING.md) for more information on how to do that.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelherold%2Fbridgetown-deploy_hook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelherold%2Fbridgetown-deploy_hook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelherold%2Fbridgetown-deploy_hook/lists"}