Giter VIP home page Giter VIP logo

heroku-buildpack-notify-slack-deploy's Introduction

heroku-buildpack-notify-slack-deploy

This is a Heroku Buildpack you can add to your Heroku deployments that will notify a Slack channel every time your application is deployed.

screenshot

Configuring your Slack Applicaiton

  1. Visit https://api.slack.com/incoming-webhooks to create a new Slack Application that can receive a webook. You only need the "Incomming Webhooks" feature.
  2. As part of the configuration, you will choose a workspace and channel to connect the application to.
  3. Take note of the webook URL, which looks something like this https://hooks.slack.com/services/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S
  4. Feel free to configure the app's icon and name!

Adding to Heroku

  1. Enable Dyno Metadata for your application heroku labs:enable runtime-dyno-metadata
  2. Save your new webook URL as a Heroku config setting for the variableSLACK_DEPLOYMENT_WEBHOOK_URL, i.e.: heroku config:set SLACK_DEPLOYMENT_WEBHOOK_URL="https://hooks.slack.com/services/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S"
  3. Add this buildpack via the Heroku dashboard using the URL https://github.com/evantahler/heroku-buildpack-notify-slack-deploy.git (the heroku buildpack:set command will replace any buildpacks you already have).
  • Note: Be sure that this buildpack is the final buildpack in your app - the order matters!

buildpack

Optional - Github Commit Information

By default, there's very little information about the commit that we can get from Heroku. However, we can curl the Github API and try to learn more about the commit. If you set the following additional environment variables, we can load the commit information, committer, and URL from Github:

  • DEPLOY_NOTIFY_GITHUB_AUTH_TOKEN: A Github PAT Token. You can generate one here Important note: you must grant repo access when creating this PAT Token, or else it will default to "Public Access" and won't work!
  • DEPLOY_NOTIFY_GITHUB_ORG: The name of your Github Org (or Github User Name)
  • DEPLOY_NOTIFY_GITHUB_PROJECT: The name of your Github Project (i.e. repository name)

Now, the message in Slack can look like:

*my-heroku-app* was deployed - Deploy 04a2729b
> Evan Tahler - [email protected]
> Fix all the bugs and make everything great
https://github.com/COMPANY/PROJECT/commit/abc123

heroku-buildpack-notify-slack-deploy's People

Contributors

evantahler avatar greg-finley avatar arbonap avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.