mirror of
https://github.com/Sea-Haven-Industries/afterhours-shift-manager.git
synced 2026-09-30 12:33:13 +00:00
Add GitHub Actions workflow for deploy notifications (#23)
Posts a Slack message to the schedule channel whenever code is pushed to main. Uses the existing Slack bot token stored as a GitHub secret.
This commit is contained in:
parent
7b2275a430
commit
5e052d424d
1 changed files with 35 additions and 0 deletions
35
.github/workflows/deploy-notify.yml
vendored
Normal file
35
.github/workflows/deploy-notify.yml
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
name: Deploy Notification
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
notify:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Extract version info from commit
|
||||
id: info
|
||||
run: |
|
||||
MSG=$(git log -1 --pretty=%s)
|
||||
echo "message=$MSG" >> "$GITHUB_OUTPUT"
|
||||
# Count merge commits on main as version number
|
||||
COUNT=$(git rev-list --count HEAD)
|
||||
echo "count=$COUNT" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Post to Slack
|
||||
env:
|
||||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|
||||
SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }}
|
||||
run: |
|
||||
curl -s -X POST https://slack.com/api/chat.postMessage \
|
||||
-H "Authorization: Bearer $SLACK_BOT_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$(jq -n \
|
||||
--arg channel "$SLACK_CHANNEL_ID" \
|
||||
--arg text ":rocket: *Deployed to production* — ${{ steps.info.outputs.message }}" \
|
||||
'{channel: $channel, text: $text}')"
|
||||
Loading…
Add table
Reference in a new issue