-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (52 loc) · 2.98 KB
/
xxc.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Отправить сообщение в Telegram
on:
push:
branches:
- main
workflow_dispatch:
jobs:
send_telegram_message:
runs-on: windows-latest
steps:
- name: Получить версию
id: get_version
run: echo "::set-output name=VERSION::xxxx" # Версия всегда "xxxx"
- name: Отправить сообщение в Telegram
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
RELEASE_URL: https://github.com/${{ github.repository }}/releases/tag/${{ steps.get_version.outputs.VERSION }}
run: |
$telegramBotToken = '${{ secrets.TELEGRAM_BOT_TOKEN }}'
$telegramChatId = '${{ secrets.TELEGRAM_CHAT_ID }}'
$releaseUrl = 'https://github.com/${{ github.repository }}/releases/tag/${{ steps.get_version.outputs.VERSION }}'
$message = 'Новый релиз: СтатичноеНазваниеРелиза`nВерсия: xxxx`nОписание: СтатичноеОписание`nSolution Name: СтатичноеНазваниеРешения`nСсылка на релиз: $releaseUrl'
$uri = 'https://api.telegram.org/bot' + $telegramBotToken + '/sendMessage'
$body = @{
chat_id = $telegramChatId
text = $message
}
$bodyJson = $body | ConvertTo-Json -Compress
Invoke-RestMethod -Uri $uri -Method Post -Body $bodyJson -ContentType 'application/json'
- name: Отправить сообщение в Telegram 2
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
RELEASE_URL: https://github.com/${{ github.repository }}/releases/tag/${{ steps.get_version.outputs.VERSION }}
run: |
$telegramBotToken = '${{ secrets.TELEGRAM_BOT_TOKEN }}'
$telegramChatId = '${{ secrets.TELEGRAM_CHAT_ID }}'
$releaseUrl = 'https://github.com/${{ github.repository }}/releases/tag/${{ steps.get_version.outputs.VERSION }}'
$message = "🎉 *Новый релиз:* ${{ github.event.inputs.namevers }}\n📦 *Версия:* ${{ steps.get_version.outputs.VERSION }}\n📝 *Описание:* ${{ github.event.inputs.descr }}\n🔧 *Solution Name:* ${{ env.Solution_Name }}\n🔗 Ссылка на релиз: $releaseUrl"
$message = $message -replace '\.', '\\.'
$message = $message -replace '\-', '\\-'
$message = $message -replace '\_', '\\_'
$message = $message -replace '\*', '\\*'
$uri = 'https://api.telegram.org/bot' + $telegramBotToken + '/sendMessage'
$body = @{
chat_id = $telegramChatId
text = $message
parse_mode = 'MarkdownV2'
}
$bodyJson = $body | ConvertTo-Json -Compress
Invoke-RestMethod -Uri $uri -Method Post -Body $bodyJson -ContentType 'application/json'