-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from sima-land/25-notify
#25 Добавить оповещения в TG
- Loading branch information
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: 'Publish notify' | ||
description: 'Log publish workflow to Telegram' | ||
author: 'sima-land team' | ||
|
||
inputs: | ||
stage: | ||
required: true | ||
description: 'Stage: "start", "done" or "fail"' | ||
tg-bot-token: | ||
required: true | ||
description: 'Telegram bot token' | ||
tg-chat-id: | ||
required: true | ||
description: 'Telegram chat id' | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Define package name | ||
if: ${{ success() && inputs.stage == 'start' }} | ||
shell: bash | ||
run: cat package.json | jq '.name' | awk '{print "package_name=" $0}' >> $GITHUB_ENV | ||
|
||
- name: Publish START message | ||
if: ${{ success() && inputs.stage == 'start' }} | ||
uses: appleboy/telegram-action@master | ||
with: | ||
token: ${{ inputs.tg-bot-token }} | ||
to: ${{ inputs.tg-chat-id }} | ||
message: | | ||
▶️ Запущена публикация пакета ${{ env.package_name }} | ||
- name: Publish DONE message | ||
if: ${{ success() && inputs.stage == 'done' }} | ||
uses: appleboy/telegram-action@master | ||
with: | ||
token: ${{ inputs.tg-bot-token }} | ||
to: ${{ inputs.tg-chat-id }} | ||
message: | | ||
✅ Опубликована версия ${{ github.ref_name }} пакета ${{ env.package_name }} | ||
Описание релиза: ${{ github.event.release.html_url }} | ||
- name: Publish FAIL message | ||
if: ${{ failure() || inputs.stage == 'fail' }} | ||
uses: appleboy/telegram-action@master | ||
with: | ||
token: ${{ inputs.tg-bot-token }} | ||
to: ${{ inputs.tg-chat-id }} | ||
message: | | ||
🆘 Не удалось опубликовать пакет ${{ env.package_name }} | ||
Детали: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters