Skip to content

BeOpinion/slack-message-release-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
 
 

Repository files navigation

Slack release message

A GitHub Action to push a slack webhook

This action suits the deploy on new tag workflow.

On your release workflow, this action will post to Slack the version, a link to the workflow and the changelog (if your changelog follows this format).

Preview

Screen Shot 2021-06-10 at 13 41 15

On Slack

Go to Slack's app manager, create a new app with an incoming webhook for the channel you want, copy the URL, that's your slack_webhook_url. If you want to make it pretty, there's an icon in this repository you can give to your app.

Inputs

version

The version you're releasing (e.g. v1.0.1, 1.0.1)

changelog

Optional, the contents of your changelog file.

Each version needs to start with ## x.y.z

slack_webhook_url

Your slack webhook URL

Example

- name: Get changelog
  id: changelog
  shell: bash
  # trick for multiline variables
  run: |
    echo "changelog<<EOF" >> $GITHUB_OUTPUT
    echo "$(head -100 HISTORY.md)" >> $GITHUB_OUTPUT
    echo "EOF" >> $GITHUB_OUTPUT

- name: Get version
  id: version
  run: echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT

- name: Notify on Slack
  uses: BeOpinion/slack-message-release-action@v1.3.1
  with:
    version: ${{ steps.version.outputs.version }}
    changelog: ${{ steps.changelog.outputs.changelog }}
    slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}

Build & Release

Github Actions does not allow to install dependencies automatically when the action is loaded. One way to fix this issue would be to version the node_modules folder. Another way would be to build the action into one single script also containing all its dependencies.

Here, we have chosen the second way. To do that, we use Vercel NCC tool.

So to build and release a new version:

  1. Build the Github Action (after installing ncc)
$ ncc build index.js -o dist
  1. Update HISTORY.md and package.json version.
  2. Commit them.
$ git add .
$ git commit -m "X.X.X release notes"
  1. Create a new tag for this version.
$ git tag -a "vX.X.X" -m "vX.X.X"
  1. Push the newly created commit and tag.
$ git push && git push --tags

About

A GitHub action to notify a release from a HISTORY.md file

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%