A simple GitHub action to post a Slack message when a new version is released.
The following inputs briefly explained here are fully declared and documented in action.yml:
github_token[Required] - GitHub tokenslack_token[Required] - Slack tokenchannel_id[Required] - Channel ID where to post (shown in 'channel details', e.g. 'C03AA0A0A3A')project_name[Required] - Project name to displayrepo_owner_name[Optional] - Repository owner namerepo_name[Optional] - Repository namerelease_tag[Optional] - Git tag of the GitHub release to announce (for examplev1.2.0). When omitted, the latest release for the repository is used.
Run this action on new tag push or new release!
on:
push:
tags:
- "v1*"
jobs:
examplejob:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Notify new release on Slack
uses: brainfish-ai/slack-notify-release
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
slack_token: ${{ secrets.SLACK_TOKEN }}
channel_id: C03AA0A0A3A
project_name: My ProjectTo announce a specific release instead of the latest one, set release_tag (it must match an existing release’s tag name):
- name: Notify new release on Slack
uses: brainfish-ai/slack-notify-release
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
slack_token: ${{ secrets.SLACK_TOKEN }}
channel_id: C03AA0A0A3A
project_name: My Project
release_tag: ${{ github.ref_name }}On a workflow triggered by push tags, github.ref_name is the tag that was pushed (for example v1.0.0).
Install dependencies
npm iBuild the action
npm run build